<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE PatternGuards #-}</span><span class="hs-cpp">

#include &quot;containers.h&quot;
</span><span>
</span><span id="line-7"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Module      :  Data.IntMap.Strict.Internal</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Copyright   :  (c) Daan Leijen 2002</span><span>
</span><span id="line-11"></span><span class="hs-comment">--                (c) Andriy Palamarchuk 2008</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     :  BSD-style</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- = Finite Int Maps (strict interface)</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- The @'IntMap' v@ type represents a finite map (sometimes called a dictionary)</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- from key of type @Int@ to values of type @v@.</span><span>
</span><span id="line-21"></span><span class="hs-comment">--</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- Each function in this module is careful to force values before installing</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- them in an 'IntMap'. This is usually more efficient when laziness is not</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- necessary. When laziness /is/ required, use the functions in</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- &quot;Data.IntMap.Lazy&quot;.</span><span>
</span><span id="line-26"></span><span class="hs-comment">--</span><span>
</span><span id="line-27"></span><span class="hs-comment">-- In particular, the functions in this module obey the following law:</span><span>
</span><span id="line-28"></span><span class="hs-comment">--</span><span>
</span><span id="line-29"></span><span class="hs-comment">--  - If all values stored in all maps in the arguments are in WHNF, then all</span><span>
</span><span id="line-30"></span><span class="hs-comment">--    values stored in all maps in the results will be in WHNF once those maps</span><span>
</span><span id="line-31"></span><span class="hs-comment">--    are evaluated.</span><span>
</span><span id="line-32"></span><span class="hs-comment">--</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- For a walkthrough of the most commonly used functions see the</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- &lt;https://haskell-containers.readthedocs.io/en/latest/map.html maps introduction&gt;.</span><span>
</span><span id="line-35"></span><span class="hs-comment">--</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- This module is intended to be imported qualified, to avoid name clashes with</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- Prelude functions:</span><span>
</span><span id="line-38"></span><span class="hs-comment">--</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- &gt; import Data.IntMap.Strict (IntMap)</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- &gt; import qualified Data.IntMap.Strict as IntMap</span><span>
</span><span id="line-41"></span><span class="hs-comment">--</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- Note that the implementation is generally /left-biased/. Functions that take</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- two maps as arguments and combine them, such as `union` and `intersection`,</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- prefer the values in the first argument to those in the second.</span><span>
</span><span id="line-45"></span><span class="hs-comment">--</span><span>
</span><span id="line-46"></span><span class="hs-comment">--</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- == Detailed performance information</span><span>
</span><span id="line-48"></span><span class="hs-comment">--</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- The amortized running time is given for each operation, with /n/ referring to</span><span>
</span><span id="line-50"></span><span class="hs-comment">-- the number of entries in the map and /W/ referring to the number of bits in</span><span>
</span><span id="line-51"></span><span class="hs-comment">-- an 'Int' (32 or 64).</span><span>
</span><span id="line-52"></span><span class="hs-comment">--</span><span>
</span><span id="line-53"></span><span class="hs-comment">-- Benchmarks comparing &quot;Data.IntMap.Strict&quot; with other dictionary</span><span>
</span><span id="line-54"></span><span class="hs-comment">-- implementations can be found at https://github.com/haskell-perf/dictionaries.</span><span>
</span><span id="line-55"></span><span class="hs-comment">--</span><span>
</span><span id="line-56"></span><span class="hs-comment">--</span><span>
</span><span id="line-57"></span><span class="hs-comment">-- == Warning</span><span>
</span><span id="line-58"></span><span class="hs-comment">--</span><span>
</span><span id="line-59"></span><span class="hs-comment">-- The 'IntMap' type is shared between the lazy and strict modules, meaning that</span><span>
</span><span id="line-60"></span><span class="hs-comment">-- the same 'IntMap' value can be passed to functions in both modules. This</span><span>
</span><span id="line-61"></span><span class="hs-comment">-- means that the 'Functor', 'Traversable' and 'Data.Data.Data' instances are</span><span>
</span><span id="line-62"></span><span class="hs-comment">-- the same as for the &quot;Data.IntMap.Lazy&quot; module, so if they are used the</span><span>
</span><span id="line-63"></span><span class="hs-comment">-- resulting map may contain suspended values (thunks).</span><span>
</span><span id="line-64"></span><span class="hs-comment">--</span><span>
</span><span id="line-65"></span><span class="hs-comment">--</span><span>
</span><span id="line-66"></span><span class="hs-comment">-- == Implementation</span><span>
</span><span id="line-67"></span><span class="hs-comment">--</span><span>
</span><span id="line-68"></span><span class="hs-comment">-- The implementation is based on /big-endian patricia trees/.  This data</span><span>
</span><span id="line-69"></span><span class="hs-comment">-- structure performs especially well on binary operations like 'union' and</span><span>
</span><span id="line-70"></span><span class="hs-comment">-- 'intersection'. Additionally, benchmarks show that it is also (much) faster</span><span>
</span><span id="line-71"></span><span class="hs-comment">-- on insertions and deletions when compared to a generic size-balanced map</span><span>
</span><span id="line-72"></span><span class="hs-comment">-- implementation (see &quot;Data.Map&quot;).</span><span>
</span><span id="line-73"></span><span class="hs-comment">--</span><span>
</span><span id="line-74"></span><span class="hs-comment">--    * Chris Okasaki and Andy Gill,  \&quot;/Fast Mergeable Integer Maps/\&quot;,</span><span>
</span><span id="line-75"></span><span class="hs-comment">--      Workshop on ML, September 1998, pages 77-86,</span><span>
</span><span id="line-76"></span><span class="hs-comment">--      &lt;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.37.5452&gt;</span><span>
</span><span id="line-77"></span><span class="hs-comment">--</span><span>
</span><span id="line-78"></span><span class="hs-comment">--    * D.R. Morrison, \&quot;/PATRICIA -- Practical Algorithm To Retrieve</span><span>
</span><span id="line-79"></span><span class="hs-comment">--      Information Coded In Alphanumeric/\&quot;, Journal of the ACM, 15(4),</span><span>
</span><span id="line-80"></span><span class="hs-comment">--      October 1968, pages 514-534.</span><span>
</span><span id="line-81"></span><span class="hs-comment">--</span><span>
</span><span id="line-82"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="hs-comment">-- See the notes at the beginning of Data.IntMap.Internal.</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.IntMap.Strict.Internal</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Map type</span></span><span class="hs-cpp">
#if !defined(TESTING)
</span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier">IntMap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier">Key</span></a></span><span>          </span><span class="hs-comment">-- instance Eq,Show</span><span class="hs-cpp">
#else
</span><span>    </span><span class="hs-identifier">IntMap</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Key</span><span>          </span><span class="hs-comment">-- instance Eq,Show</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-94"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Construction</span></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier">singleton</span></a></span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier">fromSet</span></a></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** From Unordered Lists</span></span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromList"><span class="hs-identifier">fromList</span></a></span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromListWith"><span class="hs-identifier">fromListWith</span></a></span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromListWithKey"><span class="hs-identifier">fromListWithKey</span></a></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** From Ascending Lists</span></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscList"><span class="hs-identifier">fromAscList</span></a></span><span>
</span><span id="line-106"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscListWith"><span class="hs-identifier">fromAscListWith</span></a></span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier">fromAscListWithKey</span></a></span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier">fromDistinctAscList</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Insertion</span></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier">insert</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insertWith"><span class="hs-identifier">insertWith</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier">insertWithKey</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insertLookupWithKey"><span class="hs-identifier">insertLookupWithKey</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Deletion\/Update</span></span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#delete"><span class="hs-identifier">delete</span></a></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#adjust"><span class="hs-identifier">adjust</span></a></span><span>
</span><span id="line-119"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#adjustWithKey"><span class="hs-identifier">adjustWithKey</span></a></span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#update"><span class="hs-identifier">update</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateWithKey"><span class="hs-identifier">updateWithKey</span></a></span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateLookupWithKey"><span class="hs-identifier">updateLookupWithKey</span></a></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#alter"><span class="hs-identifier">alter</span></a></span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#alterF"><span class="hs-identifier">alterF</span></a></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Query</span></span><span>
</span><span id="line-127"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Lookup</span></span><span>
</span><span id="line-128"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookup"><span class="hs-identifier">lookup</span></a></span><span>
</span><span id="line-129"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#%21%3F"><span class="hs-operator">(!?)</span></a></span><span>
</span><span id="line-130"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#%21"><span class="hs-operator">(!)</span></a></span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#findWithDefault"><span class="hs-identifier">findWithDefault</span></a></span><span>
</span><span id="line-132"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#member"><span class="hs-identifier">member</span></a></span><span>
</span><span id="line-133"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#notMember"><span class="hs-identifier">notMember</span></a></span><span>
</span><span id="line-134"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupLT"><span class="hs-identifier">lookupLT</span></a></span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupGT"><span class="hs-identifier">lookupGT</span></a></span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupLE"><span class="hs-identifier">lookupLE</span></a></span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupGE"><span class="hs-identifier">lookupGE</span></a></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Size</span></span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#size"><span class="hs-identifier">size</span></a></span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Combine</span></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Union</span></span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#union"><span class="hs-identifier">union</span></a></span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#unionWith"><span class="hs-identifier">unionWith</span></a></span><span>
</span><span id="line-148"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#unionWithKey"><span class="hs-identifier">unionWithKey</span></a></span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#unions"><span class="hs-identifier">unions</span></a></span><span>
</span><span id="line-150"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#unionsWith"><span class="hs-identifier">unionsWith</span></a></span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Difference</span></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#difference"><span class="hs-identifier">difference</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span>
</span><span id="line-155"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#differenceWith"><span class="hs-identifier">differenceWith</span></a></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#differenceWithKey"><span class="hs-identifier">differenceWithKey</span></a></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Intersection</span></span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#intersection"><span class="hs-identifier">intersection</span></a></span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#intersectionWith"><span class="hs-identifier">intersectionWith</span></a></span><span>
</span><span id="line-161"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier">intersectionWithKey</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Disjoint</span></span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#disjoint"><span class="hs-identifier">disjoint</span></a></span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Compose</span></span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#compose"><span class="hs-identifier">compose</span></a></span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Universal combining function</span></span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mergeWithKey"><span class="hs-identifier">mergeWithKey</span></a></span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Traversal</span></span><span>
</span><span id="line-173"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Map</span></span><span>
</span><span id="line-174"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-identifier">map</span></a></span><span>
</span><span id="line-175"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-identifier">mapWithKey</span></a></span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#traverseWithKey"><span class="hs-identifier">traverseWithKey</span></a></span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier">traverseMaybeWithKey</span></a></span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccum"><span class="hs-identifier">mapAccum</span></a></span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier">mapAccumWithKey</span></a></span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier">mapAccumRWithKey</span></a></span><span>
</span><span id="line-181"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#mapKeys"><span class="hs-identifier">mapKeys</span></a></span><span>
</span><span id="line-182"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapKeysWith"><span class="hs-identifier">mapKeysWith</span></a></span><span>
</span><span id="line-183"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#mapKeysMonotonic"><span class="hs-identifier">mapKeysMonotonic</span></a></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Folds</span></span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldr"><span class="hs-identifier">foldr</span></a></span><span>
</span><span id="line-187"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldl"><span class="hs-identifier">foldl</span></a></span><span>
</span><span id="line-188"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldrWithKey"><span class="hs-identifier">foldrWithKey</span></a></span><span>
</span><span id="line-189"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldlWithKey"><span class="hs-identifier">foldlWithKey</span></a></span><span>
</span><span id="line-190"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldMapWithKey"><span class="hs-identifier">foldMapWithKey</span></a></span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Strict folds</span></span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldr%27"><span class="hs-identifier">foldr'</span></a></span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span>
</span><span id="line-195"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldrWithKey%27"><span class="hs-identifier">foldrWithKey'</span></a></span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldlWithKey%27"><span class="hs-identifier">foldlWithKey'</span></a></span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Conversion</span></span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#elems"><span class="hs-identifier">elems</span></a></span><span>
</span><span id="line-200"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#keys"><span class="hs-identifier">keys</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#assocs"><span class="hs-identifier">assocs</span></a></span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#keysSet"><span class="hs-identifier">keysSet</span></a></span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Lists</span></span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#toList"><span class="hs-identifier">toList</span></a></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="annot"><span class="hs-comment">-- ** Ordered lists</span></span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#toAscList"><span class="hs-identifier">toAscList</span></a></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#toDescList"><span class="hs-identifier">toDescList</span></a></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Filter</span></span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#filter"><span class="hs-identifier">filter</span></a></span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#filterWithKey"><span class="hs-identifier">filterWithKey</span></a></span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#restrictKeys"><span class="hs-identifier">restrictKeys</span></a></span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#withoutKeys"><span class="hs-identifier">withoutKeys</span></a></span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#partition"><span class="hs-identifier">partition</span></a></span><span>
</span><span id="line-217"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#partitionWithKey"><span class="hs-identifier">partitionWithKey</span></a></span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapMaybe"><span class="hs-identifier">mapMaybe</span></a></span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier">mapMaybeWithKey</span></a></span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapEither"><span class="hs-identifier">mapEither</span></a></span><span>
</span><span id="line-222"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier">mapEitherWithKey</span></a></span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#split"><span class="hs-identifier">split</span></a></span><span>
</span><span id="line-225"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#splitLookup"><span class="hs-identifier">splitLookup</span></a></span><span>
</span><span id="line-226"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#splitRoot"><span class="hs-identifier">splitRoot</span></a></span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Submap</span></span><span>
</span><span id="line-229"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isSubmapOf"><span class="hs-identifier">isSubmapOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isSubmapOfBy"><span class="hs-identifier">isSubmapOfBy</span></a></span><span>
</span><span id="line-230"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isProperSubmapOf"><span class="hs-identifier">isProperSubmapOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isProperSubmapOfBy"><span class="hs-identifier">isProperSubmapOfBy</span></a></span><span>
</span><span id="line-231"></span><span>
</span><span id="line-232"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Min\/Max</span></span><span>
</span><span id="line-233"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupMin"><span class="hs-identifier">lookupMin</span></a></span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupMax"><span class="hs-identifier">lookupMax</span></a></span><span>
</span><span id="line-235"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#findMin"><span class="hs-identifier">findMin</span></a></span><span>
</span><span id="line-236"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#findMax"><span class="hs-identifier">findMax</span></a></span><span>
</span><span id="line-237"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteMin"><span class="hs-identifier">deleteMin</span></a></span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteMax"><span class="hs-identifier">deleteMax</span></a></span><span>
</span><span id="line-239"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteFindMin"><span class="hs-identifier">deleteFindMin</span></a></span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteFindMax"><span class="hs-identifier">deleteFindMax</span></a></span><span>
</span><span id="line-241"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMin"><span class="hs-identifier">updateMin</span></a></span><span>
</span><span id="line-242"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMax"><span class="hs-identifier">updateMax</span></a></span><span>
</span><span id="line-243"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier">updateMinWithKey</span></a></span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier">updateMaxWithKey</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#minView"><span class="hs-identifier">minView</span></a></span><span>
</span><span id="line-246"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#maxView"><span class="hs-identifier">maxView</span></a></span><span>
</span><span id="line-247"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#minViewWithKey"><span class="hs-identifier">minViewWithKey</span></a></span><span>
</span><span id="line-248"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#maxViewWithKey"><span class="hs-identifier">maxViewWithKey</span></a></span><span class="hs-cpp">

#ifdef __GLASGOW_HASKELL__
</span><span>    </span><span class="annot"><span class="hs-comment">-- * Debugging</span></span><span>
</span><span id="line-252"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.DeprecatedDebug.html#showTree"><span class="hs-identifier">showTree</span></a></span><span>
</span><span id="line-253"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.DeprecatedDebug.html#showTreeWith"><span class="hs-identifier">showTreeWith</span></a></span><span class="hs-cpp">
#endif
</span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.List.html#lookup"><span class="hs-identifier">lookup</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>
</span><span id="line-259"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#"><span class="hs-identifier">Data.Bits</span></a></span><span>
</span><span id="line-260"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html"><span class="hs-identifier">Data.IntMap.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span>
</span><span id="line-261"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html"><span class="hs-identifier">Data.IntMap.Internal</span></a></span><span>
</span><span id="line-262"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier">IntMap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-263"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier">Key</span></a></span><span>
</span><span id="line-264"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#mask"><span class="hs-identifier">mask</span></a></span><span>
</span><span id="line-265"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#branchMask"><span class="hs-identifier">branchMask</span></a></span><span>
</span><span id="line-266"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier">nomatch</span></a></span><span>
</span><span id="line-267"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier">zero</span></a></span><span>
</span><span id="line-268"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#natFromInt"><span class="hs-identifier">natFromInt</span></a></span><span>
</span><span id="line-269"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#intFromNat"><span class="hs-identifier">intFromNat</span></a></span><span>
</span><span id="line-270"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier">bin</span></a></span><span>
</span><span id="line-271"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#binCheckLeft"><span class="hs-identifier">binCheckLeft</span></a></span><span>
</span><span id="line-272"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#binCheckRight"><span class="hs-identifier">binCheckRight</span></a></span><span>
</span><span id="line-273"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier">link</span></a></span><span>
</span><span id="line-274"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#linkWithMask"><span class="hs-identifier">linkWithMask</span></a></span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#%21"><span class="hs-operator">(!)</span></a></span><span>
</span><span id="line-278"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#%21%3F"><span class="hs-operator">(!?)</span></a></span><span>
</span><span id="line-279"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-280"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#assocs"><span class="hs-identifier">assocs</span></a></span><span>
</span><span id="line-281"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#filter"><span class="hs-identifier">filter</span></a></span><span>
</span><span id="line-282"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#filterWithKey"><span class="hs-identifier">filterWithKey</span></a></span><span>
</span><span id="line-283"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#findMin"><span class="hs-identifier">findMin</span></a></span><span>
</span><span id="line-284"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#findMax"><span class="hs-identifier">findMax</span></a></span><span>
</span><span id="line-285"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldMapWithKey"><span class="hs-identifier">foldMapWithKey</span></a></span><span>
</span><span id="line-286"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldr"><span class="hs-identifier">foldr</span></a></span><span>
</span><span id="line-287"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldl"><span class="hs-identifier">foldl</span></a></span><span>
</span><span id="line-288"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldr%27"><span class="hs-identifier">foldr'</span></a></span><span>
</span><span id="line-289"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span>
</span><span id="line-290"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldlWithKey"><span class="hs-identifier">foldlWithKey</span></a></span><span>
</span><span id="line-291"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldrWithKey"><span class="hs-identifier">foldrWithKey</span></a></span><span>
</span><span id="line-292"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldlWithKey%27"><span class="hs-identifier">foldlWithKey'</span></a></span><span>
</span><span id="line-293"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#foldrWithKey%27"><span class="hs-identifier">foldrWithKey'</span></a></span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#keysSet"><span class="hs-identifier">keysSet</span></a></span><span>
</span><span id="line-295"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#mergeWithKey%27"><span class="hs-identifier">mergeWithKey'</span></a></span><span>
</span><span id="line-296"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#compose"><span class="hs-identifier">compose</span></a></span><span>
</span><span id="line-297"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#delete"><span class="hs-identifier">delete</span></a></span><span>
</span><span id="line-298"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteMin"><span class="hs-identifier">deleteMin</span></a></span><span>
</span><span id="line-299"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteMax"><span class="hs-identifier">deleteMax</span></a></span><span>
</span><span id="line-300"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteFindMax"><span class="hs-identifier">deleteFindMax</span></a></span><span>
</span><span id="line-301"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#deleteFindMin"><span class="hs-identifier">deleteFindMin</span></a></span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#difference"><span class="hs-identifier">difference</span></a></span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#elems"><span class="hs-identifier">elems</span></a></span><span>
</span><span id="line-304"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#intersection"><span class="hs-identifier">intersection</span></a></span><span>
</span><span id="line-305"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#disjoint"><span class="hs-identifier">disjoint</span></a></span><span>
</span><span id="line-306"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isProperSubmapOf"><span class="hs-identifier">isProperSubmapOf</span></a></span><span>
</span><span id="line-307"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isProperSubmapOfBy"><span class="hs-identifier">isProperSubmapOfBy</span></a></span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isSubmapOf"><span class="hs-identifier">isSubmapOf</span></a></span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#isSubmapOfBy"><span class="hs-identifier">isSubmapOfBy</span></a></span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookup"><span class="hs-identifier">lookup</span></a></span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupLE"><span class="hs-identifier">lookupLE</span></a></span><span>
</span><span id="line-312"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupGE"><span class="hs-identifier">lookupGE</span></a></span><span>
</span><span id="line-313"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupLT"><span class="hs-identifier">lookupLT</span></a></span><span>
</span><span id="line-314"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupGT"><span class="hs-identifier">lookupGT</span></a></span><span>
</span><span id="line-315"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupMin"><span class="hs-identifier">lookupMin</span></a></span><span>
</span><span id="line-316"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#lookupMax"><span class="hs-identifier">lookupMax</span></a></span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#minView"><span class="hs-identifier">minView</span></a></span><span>
</span><span id="line-318"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#maxView"><span class="hs-identifier">maxView</span></a></span><span>
</span><span id="line-319"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#minViewWithKey"><span class="hs-identifier">minViewWithKey</span></a></span><span>
</span><span id="line-320"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#maxViewWithKey"><span class="hs-identifier">maxViewWithKey</span></a></span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#keys"><span class="hs-identifier">keys</span></a></span><span>
</span><span id="line-322"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#mapKeys"><span class="hs-identifier">mapKeys</span></a></span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#mapKeysMonotonic"><span class="hs-identifier">mapKeysMonotonic</span></a></span><span>
</span><span id="line-324"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#member"><span class="hs-identifier">member</span></a></span><span>
</span><span id="line-325"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#notMember"><span class="hs-identifier">notMember</span></a></span><span>
</span><span id="line-326"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-327"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#partition"><span class="hs-identifier">partition</span></a></span><span>
</span><span id="line-328"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#partitionWithKey"><span class="hs-identifier">partitionWithKey</span></a></span><span>
</span><span id="line-329"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#restrictKeys"><span class="hs-identifier">restrictKeys</span></a></span><span>
</span><span id="line-330"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#size"><span class="hs-identifier">size</span></a></span><span>
</span><span id="line-331"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#split"><span class="hs-identifier">split</span></a></span><span>
</span><span id="line-332"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#splitLookup"><span class="hs-identifier">splitLookup</span></a></span><span>
</span><span id="line-333"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#splitRoot"><span class="hs-identifier">splitRoot</span></a></span><span>
</span><span id="line-334"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#toAscList"><span class="hs-identifier">toAscList</span></a></span><span>
</span><span id="line-335"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#toDescList"><span class="hs-identifier">toDescList</span></a></span><span>
</span><span id="line-336"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#toList"><span class="hs-identifier">toList</span></a></span><span>
</span><span id="line-337"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#union"><span class="hs-identifier">union</span></a></span><span>
</span><span id="line-338"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#unions"><span class="hs-identifier">unions</span></a></span><span>
</span><span id="line-339"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#withoutKeys"><span class="hs-identifier">withoutKeys</span></a></span><span>
</span><span id="line-340"></span><span>  </span><span class="hs-special">)</span><span class="hs-cpp">
#ifdef __GLASGOW_HASKELL__
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.DeprecatedDebug.html"><span class="hs-identifier">Data.IntMap.Internal.DeprecatedDebug</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.DeprecatedDebug.html#showTree"><span class="hs-identifier">showTree</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.DeprecatedDebug.html#showTreeWith"><span class="hs-identifier">showTreeWith</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html"><span class="hs-identifier">Data.IntSet.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">IntSet</span></span><span>
</span><span id="line-345"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.BitUtil.html"><span class="hs-identifier">Utils.Containers.Internal.BitUtil</span></a></span><span>
</span><span id="line-346"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html"><span class="hs-identifier">Utils.Containers.Internal.StrictPair</span></a></span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Functor</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator">&lt;$&gt;</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier">Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier">liftA2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-351"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Foldable</span></span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Foldable</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Foldable</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-356"></span><span class="hs-comment">{--------------------------------------------------------------------
  Query
--------------------------------------------------------------------}</span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span class="hs-comment">-- | /O(min(n,W))/. The expression @('findWithDefault' def k map)@</span><span>
</span><span id="line-361"></span><span class="hs-comment">-- returns the value at key @k@ or returns @def@ when the key is not an</span><span>
</span><span id="line-362"></span><span class="hs-comment">-- element of the map.</span><span>
</span><span id="line-363"></span><span class="hs-comment">--</span><span>
</span><span id="line-364"></span><span class="hs-comment">-- &gt; findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'</span><span>
</span><span id="line-365"></span><span class="hs-comment">-- &gt; findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'</span><span>
</span><span id="line-366"></span><span>
</span><span id="line-367"></span><span class="hs-comment">-- See IntMap.Internal.Note: Local 'go' functions and capturing]</span><span>
</span><span id="line-368"></span><span id="local-6989586621679187249"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#findWithDefault"><span class="hs-identifier hs-type">findWithDefault</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679187249"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187249"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187249"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-369"></span><span id="findWithDefault"><span class="annot"><span class="annottext">findWithDefault :: forall a. a -&gt; Key -&gt; IntMap a -&gt; a
</span><a href="Data.IntMap.Strict.Internal.html#findWithDefault"><span class="hs-identifier hs-var hs-var">findWithDefault</span></a></span></span><span> </span><span id="local-6989586621679186910"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186910"><span class="hs-identifier hs-var">def</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186909"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186909"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; a
</span><a href="#local-6989586621679186908"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-370"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-371"></span><span>    </span><span id="local-6989586621679186908"><span class="annot"><span class="annottext">go :: IntMap a -&gt; a
</span><a href="#local-6989586621679186908"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186904"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186904"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186903"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186903"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186902"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186902"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186901"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186901"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186909"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186904"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186903"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186910"><span class="hs-identifier hs-var">def</span></a></span><span>
</span><span id="line-372"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186909"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186903"><span class="hs-identifier hs-var">m</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; a
</span><a href="#local-6989586621679186908"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186902"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-373"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; a
</span><a href="#local-6989586621679186908"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186901"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-374"></span><span>    </span><span class="annot"><a href="#local-6989586621679186908"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186899"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186899"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186898"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186898"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186909"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186899"><span class="hs-identifier hs-var">kx</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186898"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-375"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186910"><span class="hs-identifier hs-var">def</span></a></span><span>
</span><span id="line-376"></span><span>    </span><span class="annot"><a href="#local-6989586621679186908"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186910"><span class="hs-identifier hs-var">def</span></a></span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span class="hs-comment">{--------------------------------------------------------------------
  Construction
--------------------------------------------------------------------}</span><span>
</span><span id="line-381"></span><span class="hs-comment">-- | /O(1)/. A map of one element.</span><span>
</span><span id="line-382"></span><span class="hs-comment">--</span><span>
</span><span id="line-383"></span><span class="hs-comment">-- &gt; singleton 1 'a'        == fromList [(1, 'a')]</span><span>
</span><span id="line-384"></span><span class="hs-comment">-- &gt; size (singleton 1 'a') == 1</span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span id="local-6989586621679187244"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187244"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187244"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-387"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span id="local-6989586621679186896"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186896"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186895"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186895"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-388"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186896"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186895"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-389"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span class="hs-comment">{--------------------------------------------------------------------
  Insert
--------------------------------------------------------------------}</span><span>
</span><span id="line-394"></span><span class="hs-comment">-- | /O(min(n,W))/. Insert a new key\/value pair in the map.</span><span>
</span><span id="line-395"></span><span class="hs-comment">-- If the key is already present in the map, the associated value is</span><span>
</span><span id="line-396"></span><span class="hs-comment">-- replaced with the supplied value, i.e. 'insert' is equivalent to</span><span>
</span><span id="line-397"></span><span class="hs-comment">-- @'insertWith' 'const'@.</span><span>
</span><span id="line-398"></span><span class="hs-comment">--</span><span>
</span><span id="line-399"></span><span class="hs-comment">-- &gt; insert 5 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'x')]</span><span>
</span><span id="line-400"></span><span class="hs-comment">-- &gt; insert 7 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'a'), (7, 'x')]</span><span>
</span><span id="line-401"></span><span class="hs-comment">-- &gt; insert 5 'x' empty                         == singleton 5 'x'</span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span id="local-6989586621679187242"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier hs-type">insert</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187242"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187242"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187242"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-404"></span><span id="insert"><span class="annot"><span class="annottext">insert :: forall a. Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier hs-var hs-var">insert</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186893"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186892"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186891"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186891"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186891"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-406"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186890"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186890"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186889"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186889"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186888"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186888"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186887"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186887"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-407"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186890"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186889"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186890"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186891"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-408"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186889"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186890"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186889"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186888"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186887"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-409"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186890"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186889"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186888"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186887"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-410"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186886"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186886"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-411"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186886"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-412"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186886"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186891"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-413"></span><span>    </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186893"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186892"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span class="hs-comment">-- right-biased insertion, used by 'union'</span><span>
</span><span id="line-416"></span><span class="hs-comment">-- | /O(min(n,W))/. Insert with a combining function.</span><span>
</span><span id="line-417"></span><span class="hs-comment">-- @'insertWith' f key value mp@</span><span>
</span><span id="line-418"></span><span class="hs-comment">-- will insert the pair (key, value) into @mp@ if key does</span><span>
</span><span id="line-419"></span><span class="hs-comment">-- not exist in the map. If the key does exist, the function will</span><span>
</span><span id="line-420"></span><span class="hs-comment">-- insert @f new_value old_value@.</span><span>
</span><span id="line-421"></span><span class="hs-comment">--</span><span>
</span><span id="line-422"></span><span class="hs-comment">-- &gt; insertWith (++) 5 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;xxxa&quot;)]</span><span>
</span><span id="line-423"></span><span class="hs-comment">-- &gt; insertWith (++) 7 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;xxx&quot;)]</span><span>
</span><span id="line-424"></span><span class="hs-comment">-- &gt; insertWith (++) 5 &quot;xxx&quot; empty                         == singleton 5 &quot;xxx&quot;</span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span id="local-6989586621679187238"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insertWith"><span class="hs-identifier hs-type">insertWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187238"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187238"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187238"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187238"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187238"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187238"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-427"></span><span id="insertWith"><span class="annot"><span class="annottext">insertWith :: forall a. (a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insertWith"><span class="hs-identifier hs-var hs-var">insertWith</span></a></span></span><span> </span><span id="local-6989586621679186885"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186885"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186884"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186884"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186883"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186883"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186882"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186882"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-428"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var">insertWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186881"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186881"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span id="local-6989586621679186880"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186880"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186885"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186881"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186880"><span class="hs-identifier hs-var">y'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186884"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186883"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186882"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span class="hs-comment">-- | /O(min(n,W))/. Insert with a combining function.</span><span>
</span><span id="line-431"></span><span class="hs-comment">-- @'insertWithKey' f key value mp@</span><span>
</span><span id="line-432"></span><span class="hs-comment">-- will insert the pair (key, value) into @mp@ if key does</span><span>
</span><span id="line-433"></span><span class="hs-comment">-- not exist in the map. If the key does exist, the function will</span><span>
</span><span id="line-434"></span><span class="hs-comment">-- insert @f key new_value old_value@.</span><span>
</span><span id="line-435"></span><span class="hs-comment">--</span><span>
</span><span id="line-436"></span><span class="hs-comment">-- &gt; let f key new_value old_value = (show key) ++ &quot;:&quot; ++ new_value ++ &quot;|&quot; ++ old_value</span><span>
</span><span id="line-437"></span><span class="hs-comment">-- &gt; insertWithKey f 5 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:xxx|a&quot;)]</span><span>
</span><span id="line-438"></span><span class="hs-comment">-- &gt; insertWithKey f 7 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;xxx&quot;)]</span><span>
</span><span id="line-439"></span><span class="hs-comment">-- &gt; insertWithKey f 5 &quot;xxx&quot; empty                         == singleton 5 &quot;xxx&quot;</span><span>
</span><span id="line-440"></span><span class="hs-comment">--</span><span>
</span><span id="line-441"></span><span class="hs-comment">-- If the key exists in the map, this function is lazy in @value@ but strict</span><span>
</span><span id="line-442"></span><span class="hs-comment">-- in the result of @f@.</span><span>
</span><span id="line-443"></span><span>
</span><span id="line-444"></span><span id="local-6989586621679187236"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-type">insertWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187236"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187236"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187236"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187236"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187236"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187236"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-445"></span><span id="insertWithKey"><span class="annot"><span class="annottext">insertWithKey :: forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var hs-var">insertWithKey</span></a></span></span><span> </span><span id="local-6989586621679186878"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186878"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186877"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186876"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186875"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186875"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186875"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-447"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186874"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186874"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186873"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186873"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186872"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186872"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186871"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186871"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-448"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186874"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186873"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186874"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186875"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-449"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186873"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186874"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186873"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var">insertWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186878"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186872"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186871"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-450"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186874"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186873"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186872"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var">insertWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186878"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186871"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-451"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186870"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186870"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679186869"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186869"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-452"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186870"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186878"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186869"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-453"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186870"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186875"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-454"></span><span>    </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186877"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186876"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-455"></span><span>
</span><span id="line-456"></span><span class="hs-comment">-- | /O(min(n,W))/. The expression (@'insertLookupWithKey' f k x map@)</span><span>
</span><span id="line-457"></span><span class="hs-comment">-- is a pair where the first element is equal to (@'lookup' k map@)</span><span>
</span><span id="line-458"></span><span class="hs-comment">-- and the second element equal to (@'insertWithKey' f k x map@).</span><span>
</span><span id="line-459"></span><span class="hs-comment">--</span><span>
</span><span id="line-460"></span><span class="hs-comment">-- &gt; let f key new_value old_value = (show key) ++ &quot;:&quot; ++ new_value ++ &quot;|&quot; ++ old_value</span><span>
</span><span id="line-461"></span><span class="hs-comment">-- &gt; insertLookupWithKey f 5 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;a&quot;, fromList [(3, &quot;b&quot;), (5, &quot;5:xxx|a&quot;)])</span><span>
</span><span id="line-462"></span><span class="hs-comment">-- &gt; insertLookupWithKey f 7 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Nothing,  fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;xxx&quot;)])</span><span>
</span><span id="line-463"></span><span class="hs-comment">-- &gt; insertLookupWithKey f 5 &quot;xxx&quot; empty                         == (Nothing,  singleton 5 &quot;xxx&quot;)</span><span>
</span><span id="line-464"></span><span class="hs-comment">--</span><span>
</span><span id="line-465"></span><span class="hs-comment">-- This is how to define @insertLookup@ using @insertLookupWithKey@:</span><span>
</span><span id="line-466"></span><span class="hs-comment">--</span><span>
</span><span id="line-467"></span><span class="hs-comment">-- &gt; let insertLookup kx x t = insertLookupWithKey (\_ a _ -&gt; a) kx x t</span><span>
</span><span id="line-468"></span><span class="hs-comment">-- &gt; insertLookup 5 &quot;x&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;a&quot;, fromList [(3, &quot;b&quot;), (5, &quot;x&quot;)])</span><span>
</span><span id="line-469"></span><span class="hs-comment">-- &gt; insertLookup 7 &quot;x&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Nothing,  fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;x&quot;)])</span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span id="local-6989586621679187231"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#insertLookupWithKey"><span class="hs-identifier hs-type">insertLookupWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-472"></span><span id="insertLookupWithKey"><span class="annot"><span class="annottext">insertLookupWithKey :: forall a.
(Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; (Maybe a, IntMap a)
</span><a href="Data.IntMap.Strict.Internal.html#insertLookupWithKey"><span class="hs-identifier hs-var hs-var">insertLookupWithKey</span></a></span></span><span> </span><span id="local-6989586621679186867"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186867"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186866"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186866"><span class="hs-identifier hs-var">k0</span></a></span></span><span> </span><span id="local-6989586621679186865"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186865"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span id="local-6989586621679186864"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186864"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Maybe a) (IntMap a) -&gt; (Maybe a, IntMap a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Maybe a) (IntMap a) -&gt; (Maybe a, IntMap a))
-&gt; StrictPair (Maybe a) (IntMap a) -&gt; (Maybe a, IntMap a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a)
-&gt; Key -&gt; a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall {a}.
(Key -&gt; a -&gt; a -&gt; a)
-&gt; Key -&gt; a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186862"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186867"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186866"><span class="hs-identifier hs-var">k0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186865"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186864"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-473"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-474"></span><span>    </span><span id="local-6989586621679186862"><span class="annot"><span class="annottext">go :: (Key -&gt; a -&gt; a -&gt; a)
-&gt; Key -&gt; a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186862"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186860"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186860"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186859"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186858"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186857"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186857"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-475"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186857"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-476"></span><span>        </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186856"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186856"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186855"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186855"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186854"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186854"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186853"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186853"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-477"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186856"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186855"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186856"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186857"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-478"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186855"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186851"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186851"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186850"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186850"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a)
-&gt; Key -&gt; a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186862"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186860"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186854"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186851"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186856"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186855"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186850"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186853"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-479"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186849"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186849"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186848"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186848"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a)
-&gt; Key -&gt; a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186862"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186860"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186853"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186849"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186856"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186855"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186854"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186848"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-480"></span><span>        </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186847"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186847"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679186846"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186846"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-481"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186847"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186846"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186860"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186846"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-482"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186847"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186857"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>        </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186859"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186858"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-484"></span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span class="hs-comment">{--------------------------------------------------------------------
  Deletion
--------------------------------------------------------------------}</span><span>
</span><span id="line-489"></span><span class="hs-comment">-- | /O(min(n,W))/. Adjust a value at a specific key. When the key is not</span><span>
</span><span id="line-490"></span><span class="hs-comment">-- a member of the map, the original map is returned.</span><span>
</span><span id="line-491"></span><span class="hs-comment">--</span><span>
</span><span id="line-492"></span><span class="hs-comment">-- &gt; adjust (&quot;new &quot; ++) 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;new a&quot;)]</span><span>
</span><span id="line-493"></span><span class="hs-comment">-- &gt; adjust (&quot;new &quot; ++) 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-494"></span><span class="hs-comment">-- &gt; adjust (&quot;new &quot; ++) 7 empty                         == empty</span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span id="local-6989586621679187222"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#adjust"><span class="hs-identifier hs-type">adjust</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187222"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187222"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187222"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187222"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-497"></span><span id="adjust"><span class="annot"><span class="annottext">adjust :: forall a. (a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#adjust"><span class="hs-identifier hs-var hs-var">adjust</span></a></span></span><span> </span><span id="local-6989586621679186845"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679186845"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186844"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186844"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186843"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186843"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-498"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-var">adjustWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186842"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186842"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679186845"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186842"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186844"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186843"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-499"></span><span>
</span><span id="line-500"></span><span class="hs-comment">-- | /O(min(n,W))/. Adjust a value at a specific key. When the key is not</span><span>
</span><span id="line-501"></span><span class="hs-comment">-- a member of the map, the original map is returned.</span><span>
</span><span id="line-502"></span><span class="hs-comment">--</span><span>
</span><span id="line-503"></span><span class="hs-comment">-- &gt; let f key x = (show key) ++ &quot;:new &quot; ++ x</span><span>
</span><span id="line-504"></span><span class="hs-comment">-- &gt; adjustWithKey f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:new a&quot;)]</span><span>
</span><span id="line-505"></span><span class="hs-comment">-- &gt; adjustWithKey f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-506"></span><span class="hs-comment">-- &gt; adjustWithKey f 7 empty                         == empty</span><span>
</span><span id="line-507"></span><span>
</span><span id="line-508"></span><span id="local-6989586621679187220"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-type">adjustWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187220"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187220"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187220"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187220"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-509"></span><span id="adjustWithKey"><span class="annot"><span class="annottext">adjustWithKey :: forall a. (Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-var hs-var">adjustWithKey</span></a></span></span><span> </span><span id="local-6989586621679186840"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a
</span><a href="#local-6989586621679186840"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186839"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186838"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186838"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-510"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186838"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-511"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186837"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186837"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186836"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186836"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186835"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186835"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186834"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186834"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-512"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186837"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186836"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186838"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-513"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186836"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186837"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186836"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-var">adjustWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a
</span><a href="#local-6989586621679186840"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186835"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186834"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-514"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186837"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186836"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186835"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-var">adjustWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a
</span><a href="#local-6989586621679186840"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186834"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-515"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186833"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186833"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679186832"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186832"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-516"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186833"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186833"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a
</span><a href="#local-6989586621679186840"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186839"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186832"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-517"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186838"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-518"></span><span>    </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span class="hs-comment">-- | /O(min(n,W))/. The expression (@'update' f k map@) updates the value @x@</span><span>
</span><span id="line-521"></span><span class="hs-comment">-- at @k@ (if it is in the map). If (@f x@) is 'Nothing', the element is</span><span>
</span><span id="line-522"></span><span class="hs-comment">-- deleted. If it is (@'Just' y@), the key @k@ is bound to the new value @y@.</span><span>
</span><span id="line-523"></span><span class="hs-comment">--</span><span>
</span><span id="line-524"></span><span class="hs-comment">-- &gt; let f x = if x == &quot;a&quot; then Just &quot;new a&quot; else Nothing</span><span>
</span><span id="line-525"></span><span class="hs-comment">-- &gt; update f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;new a&quot;)]</span><span>
</span><span id="line-526"></span><span class="hs-comment">-- &gt; update f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-527"></span><span class="hs-comment">-- &gt; update f 3 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span id="local-6989586621679187218"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#update"><span class="hs-identifier hs-type">update</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187218"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187218"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187218"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187218"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-530"></span><span id="update"><span class="annot"><span class="annottext">update :: forall a. (a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#update"><span class="hs-identifier hs-var hs-var">update</span></a></span></span><span> </span><span id="local-6989586621679186831"><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679186831"><span class="hs-identifier hs-var">f</span></a></span></span><span>
</span><span id="line-531"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-var">updateWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186830"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186830"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679186831"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186830"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-532"></span><span>
</span><span id="line-533"></span><span class="hs-comment">-- | /O(min(n,W))/. The expression (@'update' f k map@) updates the value @x@</span><span>
</span><span id="line-534"></span><span class="hs-comment">-- at @k@ (if it is in the map). If (@f k x@) is 'Nothing', the element is</span><span>
</span><span id="line-535"></span><span class="hs-comment">-- deleted. If it is (@'Just' y@), the key @k@ is bound to the new value @y@.</span><span>
</span><span id="line-536"></span><span class="hs-comment">--</span><span>
</span><span id="line-537"></span><span class="hs-comment">-- &gt; let f k x = if x == &quot;a&quot; then Just ((show k) ++ &quot;:new a&quot;) else Nothing</span><span>
</span><span id="line-538"></span><span class="hs-comment">-- &gt; updateWithKey f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:new a&quot;)]</span><span>
</span><span id="line-539"></span><span class="hs-comment">-- &gt; updateWithKey f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-540"></span><span class="hs-comment">-- &gt; updateWithKey f 3 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-541"></span><span>
</span><span id="line-542"></span><span id="local-6989586621679187216"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-type">updateWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187216"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187216"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187216"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187216"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-543"></span><span id="updateWithKey"><span class="annot"><span class="annottext">updateWithKey :: forall a. (Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-var hs-var">updateWithKey</span></a></span></span><span> </span><span id="local-6989586621679186828"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186828"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186827"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186826"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186826"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-544"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186826"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-545"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186825"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186825"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186824"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186824"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186823"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186823"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186822"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186822"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-546"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186825"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186824"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186826"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-547"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186824"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckLeft"><span class="hs-identifier hs-var">binCheckLeft</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186825"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186824"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-var">updateWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186828"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186823"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186822"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-548"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckRight"><span class="hs-identifier hs-var">binCheckRight</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186825"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186824"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186823"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-var">updateWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186828"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186822"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-549"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186821"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186821"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679186820"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186820"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-550"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186821"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186828"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186827"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186820"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-551"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186819"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186819"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186821"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186819"><span class="hs-identifier hs-var">y'</span></a></span><span>
</span><span id="line-552"></span><span>                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-553"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186826"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-554"></span><span>    </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-555"></span><span>
</span><span id="line-556"></span><span class="hs-comment">-- | /O(min(n,W))/. Lookup and update.</span><span>
</span><span id="line-557"></span><span class="hs-comment">-- The function returns original value, if it is updated.</span><span>
</span><span id="line-558"></span><span class="hs-comment">-- This is different behavior than 'Data.Map.updateLookupWithKey'.</span><span>
</span><span id="line-559"></span><span class="hs-comment">-- Returns the original key value if the map entry is deleted.</span><span>
</span><span id="line-560"></span><span class="hs-comment">--</span><span>
</span><span id="line-561"></span><span class="hs-comment">-- &gt; let f k x = if x == &quot;a&quot; then Just ((show k) ++ &quot;:new a&quot;) else Nothing</span><span>
</span><span id="line-562"></span><span class="hs-comment">-- &gt; updateLookupWithKey f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;a&quot;, fromList [(3, &quot;b&quot;), (5, &quot;5:new a&quot;)])</span><span>
</span><span id="line-563"></span><span class="hs-comment">-- &gt; updateLookupWithKey f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Nothing,  fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)])</span><span>
</span><span id="line-564"></span><span class="hs-comment">-- &gt; updateLookupWithKey f 3 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;b&quot;, singleton 5 &quot;a&quot;)</span><span>
</span><span id="line-565"></span><span>
</span><span id="line-566"></span><span id="local-6989586621679187214"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateLookupWithKey"><span class="hs-identifier hs-type">updateLookupWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187214"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187214"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187214"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187214"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187214"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-567"></span><span id="updateLookupWithKey"><span class="annot"><span class="annottext">updateLookupWithKey :: forall a.
(Key -&gt; a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; (Maybe a, IntMap a)
</span><a href="Data.IntMap.Strict.Internal.html#updateLookupWithKey"><span class="hs-identifier hs-var hs-var">updateLookupWithKey</span></a></span></span><span> </span><span id="local-6989586621679186818"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186818"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186817"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186817"><span class="hs-identifier hs-var">k0</span></a></span></span><span> </span><span id="local-6989586621679186816"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186816"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Maybe a) (IntMap a) -&gt; (Maybe a, IntMap a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Maybe a) (IntMap a) -&gt; (Maybe a, IntMap a))
-&gt; StrictPair (Maybe a) (IntMap a) -&gt; (Maybe a, IntMap a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a)
-&gt; Key -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall {a}.
(Key -&gt; a -&gt; Maybe a)
-&gt; Key -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186815"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186818"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186817"><span class="hs-identifier hs-var">k0</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186816"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-568"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-569"></span><span>    </span><span id="local-6989586621679186815"><span class="annot"><span class="annottext">go :: (Key -&gt; a -&gt; Maybe a)
-&gt; Key -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186815"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186813"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186813"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186812"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186811"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186811"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-570"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186811"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-571"></span><span>        </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186810"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186810"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186809"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186809"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186808"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186808"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186807"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186807"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-572"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186810"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186809"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186811"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186809"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186806"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186806"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186805"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186805"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a)
-&gt; Key -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186815"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186813"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186808"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186806"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckLeft"><span class="hs-identifier hs-var">binCheckLeft</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186810"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186809"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186805"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186807"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186804"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186804"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186803"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186803"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a)
-&gt; Key -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
</span><a href="#local-6989586621679186815"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186813"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186807"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186804"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckRight"><span class="hs-identifier hs-var">binCheckRight</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186810"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186809"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186808"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186803"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-575"></span><span>        </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186802"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186802"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679186801"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186801"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-576"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186802"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186813"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186812"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186801"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-577"></span><span>                               </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186800"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186800"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186801"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186802"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186800"><span class="hs-identifier hs-var">y'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-578"></span><span>                               </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186801"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-579"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186811"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-580"></span><span>        </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IntMap a -&gt; StrictPair (Maybe a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>
</span><span id="line-582"></span><span>
</span><span id="line-583"></span><span>
</span><span id="line-584"></span><span class="hs-comment">-- | /O(min(n,W))/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof.</span><span>
</span><span id="line-585"></span><span class="hs-comment">-- 'alter' can be used to insert, delete, or update a value in an 'IntMap'.</span><span>
</span><span id="line-586"></span><span class="hs-comment">-- In short : @'lookup' k ('alter' f k m) = f ('lookup' k m)@.</span><span>
</span><span id="line-587"></span><span id="local-6989586621679187211"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#alter"><span class="hs-identifier hs-type">alter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187211"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187211"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187211"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187211"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-588"></span><span id="alter"><span class="annot"><span class="annottext">alter :: forall a. (Maybe a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#alter"><span class="hs-identifier hs-var hs-var">alter</span></a></span></span><span> </span><span id="local-6989586621679186798"><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186797"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186796"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186796"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-589"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186796"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-590"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186795"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186795"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186794"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186794"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186793"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186793"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186792"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186792"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-591"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#nomatch"><span class="hs-identifier hs-var">nomatch</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186795"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186794"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-592"></span><span>                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186796"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-593"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186791"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186791"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186791"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186795"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186796"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-594"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
</span><a href="Data.IntMap.Internal.html#zero"><span class="hs-identifier hs-var">zero</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186794"><span class="hs-identifier hs-var">m</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckLeft"><span class="hs-identifier hs-var">binCheckLeft</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186795"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186794"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Maybe a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#alter"><span class="hs-identifier hs-var">alter</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186793"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186792"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-595"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckRight"><span class="hs-identifier hs-var">binCheckRight</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186795"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186794"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186793"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Maybe a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#alter"><span class="hs-identifier hs-var">alter</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186792"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-596"></span><span>    </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186790"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186790"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679186789"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186789"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-597"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186790"><span class="hs-identifier hs-var">ky</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186789"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-598"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186788"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186788"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186790"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186788"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-599"></span><span>                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-600"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-601"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186787"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186787"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186787"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186790"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186796"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-602"></span><span>                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186796"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-603"></span><span>    </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679186798"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-604"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186786"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186786"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186797"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186786"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-605"></span><span>                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-606"></span><span>
</span><span id="line-607"></span><span class="hs-comment">-- | /O(log n)/. The expression (@'alterF' f k map@) alters the value @x@ at</span><span>
</span><span id="line-608"></span><span class="hs-comment">-- @k@, or absence thereof.  'alterF' can be used to inspect, insert, delete,</span><span>
</span><span id="line-609"></span><span class="hs-comment">-- or update a value in an 'IntMap'.  In short : @'lookup' k &lt;$&gt; 'alterF' f k m = f</span><span>
</span><span id="line-610"></span><span class="hs-comment">-- ('lookup' k m)@.</span><span>
</span><span id="line-611"></span><span class="hs-comment">--</span><span>
</span><span id="line-612"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-613"></span><span class="hs-comment">--</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-615"></span><span class="hs-comment">-- interactiveAlter :: Int -&gt; IntMap String -&gt; IO (IntMap String)</span><span>
</span><span id="line-616"></span><span class="hs-comment">-- interactiveAlter k m = alterF f k m where</span><span>
</span><span id="line-617"></span><span class="hs-comment">--   f Nothing = do</span><span>
</span><span id="line-618"></span><span class="hs-comment">--      putStrLn $ show k ++</span><span>
</span><span id="line-619"></span><span class="hs-comment">--          &quot; was not found in the map. Would you like to add it?&quot;</span><span>
</span><span id="line-620"></span><span class="hs-comment">--      getUserResponse1 :: IO (Maybe String)</span><span>
</span><span id="line-621"></span><span class="hs-comment">--   f (Just old) = do</span><span>
</span><span id="line-622"></span><span class="hs-comment">--      putStrLn $ &quot;The key is currently bound to &quot; ++ show old ++</span><span>
</span><span id="line-623"></span><span class="hs-comment">--          &quot;. Would you like to change or delete it?&quot;</span><span>
</span><span id="line-624"></span><span class="hs-comment">--      getUserResponse2 :: IO (Maybe String)</span><span>
</span><span id="line-625"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-626"></span><span class="hs-comment">--</span><span>
</span><span id="line-627"></span><span class="hs-comment">-- 'alterF' is the most general operation for working with an individual</span><span>
</span><span id="line-628"></span><span class="hs-comment">-- key that may or may not be in a given map.</span><span>
</span><span id="line-629"></span><span>
</span><span id="line-630"></span><span class="hs-comment">-- Note: 'alterF' is a flipped version of the 'at' combinator from</span><span>
</span><span id="line-631"></span><span class="hs-comment">-- 'Control.Lens.At'.</span><span>
</span><span id="line-632"></span><span class="hs-comment">--</span><span>
</span><span id="line-633"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-634"></span><span>
</span><span id="line-635"></span><span id="local-6989586621679187208"><span id="local-6989586621679187209"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#alterF"><span class="hs-identifier hs-type">alterF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187209"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-636"></span><span>       </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187208"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187209"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187208"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187208"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187209"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187208"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-637"></span><span class="hs-comment">-- This implementation was modified from 'Control.Lens.At'.</span><span>
</span><span id="line-638"></span><span id="alterF"><span class="annot"><span class="annottext">alterF :: forall (f :: * -&gt; *) a.
Functor f =&gt;
(Maybe a -&gt; f (Maybe a)) -&gt; Key -&gt; IntMap a -&gt; f (IntMap a)
</span><a href="Data.IntMap.Strict.Internal.html#alterF"><span class="hs-identifier hs-var hs-var">alterF</span></a></span></span><span> </span><span id="local-6989586621679186783"><span class="annot"><span class="annottext">Maybe a -&gt; f (Maybe a)
</span><a href="#local-6989586621679186783"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186782"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186782"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186781"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186781"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe a -&gt; IntMap a) -&gt; f (Maybe a) -&gt; f (IntMap a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; f (Maybe a)
</span><a href="#local-6989586621679186783"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186779"><span class="hs-identifier hs-var">mv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((Maybe a -&gt; IntMap a) -&gt; f (IntMap a))
-&gt; (Maybe a -&gt; IntMap a) -&gt; f (IntMap a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679186778"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186778"><span class="hs-identifier hs-var">fres</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-639"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186778"><span class="hs-identifier hs-var">fres</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-640"></span><span>    </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; (a -&gt; IntMap a) -&gt; Maybe a -&gt; IntMap a
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186781"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; a -&gt; IntMap a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#delete"><span class="hs-identifier hs-var">delete</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186782"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186781"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679186779"><span class="hs-identifier hs-var">mv</span></a></span><span>
</span><span id="line-641"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186775"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186775"><span class="hs-identifier hs-var">v'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186782"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186775"><span class="hs-identifier hs-var">v'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186781"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-642"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679186779"><span class="annot"><span class="annottext">mv :: Maybe a
</span><a href="#local-6989586621679186779"><span class="hs-identifier hs-var hs-var">mv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; Maybe a
forall a. Key -&gt; IntMap a -&gt; Maybe a
</span><a href="Data.IntMap.Internal.html#lookup"><span class="hs-identifier hs-var">lookup</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186782"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186781"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span class="hs-comment">{--------------------------------------------------------------------
  Union
--------------------------------------------------------------------}</span><span>
</span><span id="line-648"></span><span class="hs-comment">-- | The union of a list of maps, with a combining operation.</span><span>
</span><span id="line-649"></span><span class="hs-comment">--</span><span>
</span><span id="line-650"></span><span class="hs-comment">-- &gt; unionsWith (++) [(fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]), (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]), (fromList [(5, &quot;A3&quot;), (3, &quot;B3&quot;)])]</span><span>
</span><span id="line-651"></span><span class="hs-comment">-- &gt;     == fromList [(3, &quot;bB3&quot;), (5, &quot;aAA3&quot;), (7, &quot;C&quot;)]</span><span>
</span><span id="line-652"></span><span>
</span><span id="line-653"></span><span id="local-6989586621679187195"><span id="local-6989586621679187196"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#unionsWith"><span class="hs-identifier hs-type">unionsWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#Foldable"><span class="hs-identifier hs-type">Foldable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187196"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187195"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679187195"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679187195"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187196"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187195"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187195"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-654"></span><span id="unionsWith"><span class="annot"><span class="annottext">unionsWith :: forall (f :: * -&gt; *) a.
Foldable f =&gt;
(a -&gt; a -&gt; a) -&gt; f (IntMap a) -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#unionsWith"><span class="hs-identifier hs-var hs-var">unionsWith</span></a></span></span><span> </span><span id="local-6989586621679186772"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186772"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186771"><span class="annot"><span class="annottext">f (IntMap a)
</span><a href="#local-6989586621679186771"><span class="hs-identifier hs-var">ts</span></a></span></span><span>
</span><span id="line-655"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap a -&gt; IntMap a -&gt; IntMap a)
-&gt; IntMap a -&gt; f (IntMap a) -&gt; IntMap a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. (a -&gt; a -&gt; a) -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186772"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="annot"><span class="annottext">f (IntMap a)
</span><a href="#local-6989586621679186771"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-656"></span><span>
</span><span id="line-657"></span><span class="hs-comment">-- | /O(n+m)/. The union with a combining function.</span><span>
</span><span id="line-658"></span><span class="hs-comment">--</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- &gt; unionWith (++) (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;aA&quot;), (7, &quot;C&quot;)]</span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span id="local-6989586621679187189"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#unionWith"><span class="hs-identifier hs-type">unionWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187189"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187189"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187189"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187189"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187189"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187189"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-662"></span><span id="unionWith"><span class="annot"><span class="annottext">unionWith :: forall a. (a -&gt; a -&gt; a) -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var hs-var">unionWith</span></a></span></span><span> </span><span id="local-6989586621679186769"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186769"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186768"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186768"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621679186767"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186767"><span class="hs-identifier hs-var">m2</span></a></span></span><span>
</span><span id="line-663"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a) -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186766"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186766"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186765"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186765"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186769"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186766"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186765"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186768"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186767"><span class="hs-identifier hs-var">m2</span></a></span><span>
</span><span id="line-664"></span><span>
</span><span id="line-665"></span><span class="hs-comment">-- | /O(n+m)/. The union with a combining function.</span><span>
</span><span id="line-666"></span><span class="hs-comment">--</span><span>
</span><span id="line-667"></span><span class="hs-comment">-- &gt; let f key left_value right_value = (show key) ++ &quot;:&quot; ++ left_value ++ &quot;|&quot; ++ right_value</span><span>
</span><span id="line-668"></span><span class="hs-comment">-- &gt; unionWithKey f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:a|A&quot;), (7, &quot;C&quot;)]</span><span>
</span><span id="line-669"></span><span>
</span><span id="line-670"></span><span id="local-6989586621679187187"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-type">unionWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187187"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187187"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187187"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187187"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187187"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187187"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-671"></span><span id="unionWithKey"><span class="annot"><span class="annottext">unionWithKey :: forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var hs-var">unionWithKey</span></a></span></span><span> </span><span id="local-6989586621679186764"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186764"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186763"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186763"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621679186762"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186762"><span class="hs-identifier hs-var">m2</span></a></span></span><span>
</span><span id="line-672"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a)
-&gt; (IntMap a -&gt; IntMap a -&gt; IntMap a)
-&gt; (IntMap a -&gt; IntMap a)
-&gt; (IntMap a -&gt; IntMap a)
-&gt; IntMap a
-&gt; IntMap a
-&gt; IntMap a
forall c a b.
(Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap b -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
</span><a href="Data.IntMap.Internal.html#mergeWithKey%27"><span class="hs-identifier hs-var">mergeWithKey'</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186761"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186761"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621679186760"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186760"><span class="hs-identifier hs-var">x1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186759"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186759"><span class="hs-identifier hs-var">_k2</span></a></span></span><span> </span><span id="local-6989586621679186758"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186758"><span class="hs-identifier hs-var">x2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186761"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186764"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186761"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186760"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186758"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186763"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186762"><span class="hs-identifier hs-var">m2</span></a></span><span>
</span><span id="line-673"></span><span>
</span><span id="line-674"></span><span class="hs-comment">{--------------------------------------------------------------------
  Difference
--------------------------------------------------------------------}</span><span>
</span><span id="line-677"></span><span>
</span><span id="line-678"></span><span class="hs-comment">-- | /O(n+m)/. Difference with a combining function.</span><span>
</span><span id="line-679"></span><span class="hs-comment">--</span><span>
</span><span id="line-680"></span><span class="hs-comment">-- &gt; let f al ar = if al == &quot;b&quot; then Just (al ++ &quot;:&quot; ++ ar) else Nothing</span><span>
</span><span id="line-681"></span><span class="hs-comment">-- &gt; differenceWith f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (3, &quot;B&quot;), (7, &quot;C&quot;)])</span><span>
</span><span id="line-682"></span><span class="hs-comment">-- &gt;     == singleton 3 &quot;b:B&quot;</span><span>
</span><span id="line-683"></span><span>
</span><span id="line-684"></span><span id="local-6989586621679187180"><span id="local-6989586621679187181"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#differenceWith"><span class="hs-identifier hs-type">differenceWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187181"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187180"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187181"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187181"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187180"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187181"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-685"></span><span id="differenceWith"><span class="annot"><span class="annottext">differenceWith :: forall a b. (a -&gt; b -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#differenceWith"><span class="hs-identifier hs-var hs-var">differenceWith</span></a></span></span><span> </span><span id="local-6989586621679186756"><span class="annot"><span class="annottext">a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679186756"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186755"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186755"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621679186754"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186754"><span class="hs-identifier hs-var">m2</span></a></span></span><span>
</span><span id="line-686"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; b -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap a
forall a b.
(Key -&gt; a -&gt; b -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#differenceWithKey"><span class="hs-identifier hs-var">differenceWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186753"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186753"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186752"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186752"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679186756"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186753"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186752"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186755"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186754"><span class="hs-identifier hs-var">m2</span></a></span><span>
</span><span id="line-687"></span><span>
</span><span id="line-688"></span><span class="hs-comment">-- | /O(n+m)/. Difference with a combining function. When two equal keys are</span><span>
</span><span id="line-689"></span><span class="hs-comment">-- encountered, the combining function is applied to the key and both values.</span><span>
</span><span id="line-690"></span><span class="hs-comment">-- If it returns 'Nothing', the element is discarded (proper set difference).</span><span>
</span><span id="line-691"></span><span class="hs-comment">-- If it returns (@'Just' y@), the element is updated with a new value @y@.</span><span>
</span><span id="line-692"></span><span class="hs-comment">--</span><span>
</span><span id="line-693"></span><span class="hs-comment">-- &gt; let f k al ar = if al == &quot;b&quot; then Just ((show k) ++ &quot;:&quot; ++ al ++ &quot;|&quot; ++ ar) else Nothing</span><span>
</span><span id="line-694"></span><span class="hs-comment">-- &gt; differenceWithKey f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (3, &quot;B&quot;), (10, &quot;C&quot;)])</span><span>
</span><span id="line-695"></span><span class="hs-comment">-- &gt;     == singleton 3 &quot;3:b|B&quot;</span><span>
</span><span id="line-696"></span><span>
</span><span id="line-697"></span><span id="local-6989586621679187176"><span id="local-6989586621679187177"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#differenceWithKey"><span class="hs-identifier hs-type">differenceWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187177"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187176"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187177"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187177"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187176"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187177"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-698"></span><span id="differenceWithKey"><span class="annot"><span class="annottext">differenceWithKey :: forall a b.
(Key -&gt; a -&gt; b -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#differenceWithKey"><span class="hs-identifier hs-var hs-var">differenceWithKey</span></a></span></span><span> </span><span id="local-6989586621679186751"><span class="annot"><span class="annottext">Key -&gt; a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679186751"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186750"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186750"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621679186749"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186749"><span class="hs-identifier hs-var">m2</span></a></span></span><span>
</span><span id="line-699"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; b -&gt; Maybe a)
-&gt; (IntMap a -&gt; IntMap a)
-&gt; (IntMap b -&gt; IntMap a)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap a
forall a b c.
(Key -&gt; a -&gt; b -&gt; Maybe c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
</span><a href="Data.IntMap.Strict.Internal.html#mergeWithKey"><span class="hs-identifier hs-var">mergeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679186751"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap b -&gt; IntMap a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186750"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186749"><span class="hs-identifier hs-var">m2</span></a></span><span>
</span><span id="line-700"></span><span>
</span><span id="line-701"></span><span class="hs-comment">{--------------------------------------------------------------------
  Intersection
--------------------------------------------------------------------}</span><span>
</span><span id="line-704"></span><span>
</span><span id="line-705"></span><span class="hs-comment">-- | /O(n+m)/. The intersection with a combining function.</span><span>
</span><span id="line-706"></span><span class="hs-comment">--</span><span>
</span><span id="line-707"></span><span class="hs-comment">-- &gt; intersectionWith (++) (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == singleton 5 &quot;aA&quot;</span><span>
</span><span id="line-708"></span><span>
</span><span id="line-709"></span><span id="local-6989586621679187168"><span id="local-6989586621679187169"><span id="local-6989586621679187170"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-type">intersectionWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187170"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187169"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187168"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187170"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187169"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187168"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-710"></span><span id="intersectionWith"><span class="annot"><span class="annottext">intersectionWith :: forall a b c. (a -&gt; b -&gt; c) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap c
</span><a href="Data.IntMap.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-var hs-var">intersectionWith</span></a></span></span><span> </span><span id="local-6989586621679186748"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679186748"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186747"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186747"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621679186746"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186746"><span class="hs-identifier hs-var">m2</span></a></span></span><span>
</span><span id="line-711"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; b -&gt; c) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap c
forall a b c.
(Key -&gt; a -&gt; b -&gt; c) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap c
</span><a href="Data.IntMap.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var">intersectionWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186745"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186745"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186744"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186744"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679186748"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186745"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186744"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186747"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186746"><span class="hs-identifier hs-var">m2</span></a></span><span>
</span><span id="line-712"></span><span>
</span><span id="line-713"></span><span class="hs-comment">-- | /O(n+m)/. The intersection with a combining function.</span><span>
</span><span id="line-714"></span><span class="hs-comment">--</span><span>
</span><span id="line-715"></span><span class="hs-comment">-- &gt; let f k al ar = (show k) ++ &quot;:&quot; ++ al ++ &quot;|&quot; ++ ar</span><span>
</span><span id="line-716"></span><span class="hs-comment">-- &gt; intersectionWithKey f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == singleton 5 &quot;5:a|A&quot;</span><span>
</span><span id="line-717"></span><span>
</span><span id="line-718"></span><span id="local-6989586621679187162"><span id="local-6989586621679187163"><span id="local-6989586621679187164"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-type">intersectionWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187164"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187163"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187162"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187164"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187163"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187162"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-719"></span><span id="intersectionWithKey"><span class="annot"><span class="annottext">intersectionWithKey :: forall a b c.
(Key -&gt; a -&gt; b -&gt; c) -&gt; IntMap a -&gt; IntMap b -&gt; IntMap c
</span><a href="Data.IntMap.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var hs-var">intersectionWithKey</span></a></span></span><span> </span><span id="local-6989586621679186743"><span class="annot"><span class="annottext">Key -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679186743"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186742"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186742"><span class="hs-identifier hs-var">m1</span></a></span></span><span> </span><span id="local-6989586621679186741"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186741"><span class="hs-identifier hs-var">m2</span></a></span></span><span>
</span><span id="line-720"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap b -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
forall c a b.
(Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap b -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
</span><a href="Data.IntMap.Internal.html#mergeWithKey%27"><span class="hs-identifier hs-var">mergeWithKey'</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186740"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186740"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621679186739"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186739"><span class="hs-identifier hs-var">x1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186738"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186738"><span class="hs-identifier hs-var">_k2</span></a></span></span><span> </span><span id="local-6989586621679186737"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186737"><span class="hs-identifier hs-var">x2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; c -&gt; IntMap c
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186740"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">(c -&gt; IntMap c) -&gt; c -&gt; IntMap c
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679186743"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186740"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186739"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186737"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap c -&gt; IntMap a -&gt; IntMap c
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap c
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap c -&gt; IntMap b -&gt; IntMap c
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap c
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186742"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186741"><span class="hs-identifier hs-var">m2</span></a></span><span>
</span><span id="line-721"></span><span>
</span><span id="line-722"></span><span class="hs-comment">{--------------------------------------------------------------------
  MergeWithKey
--------------------------------------------------------------------}</span><span>
</span><span id="line-725"></span><span>
</span><span id="line-726"></span><span class="hs-comment">-- | /O(n+m)/. A high-performance universal combining function. Using</span><span>
</span><span id="line-727"></span><span class="hs-comment">-- 'mergeWithKey', all combining functions can be defined without any loss of</span><span>
</span><span id="line-728"></span><span class="hs-comment">-- efficiency (with exception of 'union', 'difference' and 'intersection',</span><span>
</span><span id="line-729"></span><span class="hs-comment">-- where sharing of some nodes is lost with 'mergeWithKey').</span><span>
</span><span id="line-730"></span><span class="hs-comment">--</span><span>
</span><span id="line-731"></span><span class="hs-comment">-- Please make sure you know what is going on when using 'mergeWithKey',</span><span>
</span><span id="line-732"></span><span class="hs-comment">-- otherwise you can be surprised by unexpected code growth or even</span><span>
</span><span id="line-733"></span><span class="hs-comment">-- corruption of the data structure.</span><span>
</span><span id="line-734"></span><span class="hs-comment">--</span><span>
</span><span id="line-735"></span><span class="hs-comment">-- When 'mergeWithKey' is given three arguments, it is inlined to the call</span><span>
</span><span id="line-736"></span><span class="hs-comment">-- site. You should therefore use 'mergeWithKey' only to define your custom</span><span>
</span><span id="line-737"></span><span class="hs-comment">-- combining functions. For example, you could define 'unionWithKey',</span><span>
</span><span id="line-738"></span><span class="hs-comment">-- 'differenceWithKey' and 'intersectionWithKey' as</span><span>
</span><span id="line-739"></span><span class="hs-comment">--</span><span>
</span><span id="line-740"></span><span class="hs-comment">-- &gt; myUnionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -&gt; Just (f k x1 x2)) id id m1 m2</span><span>
</span><span id="line-741"></span><span class="hs-comment">-- &gt; myDifferenceWithKey f m1 m2 = mergeWithKey f id (const empty) m1 m2</span><span>
</span><span id="line-742"></span><span class="hs-comment">-- &gt; myIntersectionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -&gt; Just (f k x1 x2)) (const empty) (const empty) m1 m2</span><span>
</span><span id="line-743"></span><span class="hs-comment">--</span><span>
</span><span id="line-744"></span><span class="hs-comment">-- When calling @'mergeWithKey' combine only1 only2@, a function combining two</span><span>
</span><span id="line-745"></span><span class="hs-comment">-- 'IntMap's is created, such that</span><span>
</span><span id="line-746"></span><span class="hs-comment">--</span><span>
</span><span id="line-747"></span><span class="hs-comment">-- * if a key is present in both maps, it is passed with both corresponding</span><span>
</span><span id="line-748"></span><span class="hs-comment">--   values to the @combine@ function. Depending on the result, the key is either</span><span>
</span><span id="line-749"></span><span class="hs-comment">--   present in the result with specified value, or is left out;</span><span>
</span><span id="line-750"></span><span class="hs-comment">--</span><span>
</span><span id="line-751"></span><span class="hs-comment">-- * a nonempty subtree present only in the first map is passed to @only1@ and</span><span>
</span><span id="line-752"></span><span class="hs-comment">--   the output is added to the result;</span><span>
</span><span id="line-753"></span><span class="hs-comment">--</span><span>
</span><span id="line-754"></span><span class="hs-comment">-- * a nonempty subtree present only in the second map is passed to @only2@ and</span><span>
</span><span id="line-755"></span><span class="hs-comment">--   the output is added to the result.</span><span>
</span><span id="line-756"></span><span class="hs-comment">--</span><span>
</span><span id="line-757"></span><span class="hs-comment">-- The @only1@ and @only2@ methods /must return a map with a subset (possibly empty) of the keys of the given map/.</span><span>
</span><span id="line-758"></span><span class="hs-comment">-- The values can be modified arbitrarily.  Most common variants of @only1@ and</span><span>
</span><span id="line-759"></span><span class="hs-comment">-- @only2@ are 'id' and @'const' 'empty'@, but for example @'map' f@ or</span><span>
</span><span id="line-760"></span><span class="hs-comment">-- @'filterWithKey' f@ could be used for any @f@.</span><span>
</span><span id="line-761"></span><span>
</span><span id="line-762"></span><span id="local-6989586621679187171"><span id="local-6989586621679187172"><span id="local-6989586621679187173"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mergeWithKey"><span class="hs-identifier hs-type">mergeWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187172"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187171"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187171"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187172"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187171"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-763"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187172"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187171"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-764"></span><span id="mergeWithKey"><span class="annot"><span class="annottext">mergeWithKey :: forall a b c.
(Key -&gt; a -&gt; b -&gt; Maybe c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
</span><a href="Data.IntMap.Strict.Internal.html#mergeWithKey"><span class="hs-identifier hs-var hs-var">mergeWithKey</span></a></span></span><span> </span><span id="local-6989586621679186736"><span class="annot"><span class="annottext">Key -&gt; a -&gt; b -&gt; Maybe c
</span><a href="#local-6989586621679186736"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186735"><span class="annot"><span class="annottext">IntMap a -&gt; IntMap c
</span><a href="#local-6989586621679186735"><span class="hs-identifier hs-var">g1</span></a></span></span><span> </span><span id="local-6989586621679186734"><span class="annot"><span class="annottext">IntMap b -&gt; IntMap c
</span><a href="#local-6989586621679186734"><span class="hs-identifier hs-var">g2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap b -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
forall c a b.
(Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap b -&gt; IntMap c)
-&gt; (IntMap a -&gt; IntMap c)
-&gt; (IntMap b -&gt; IntMap c)
-&gt; IntMap a
-&gt; IntMap b
-&gt; IntMap c
</span><a href="Data.IntMap.Internal.html#mergeWithKey%27"><span class="hs-identifier hs-var">mergeWithKey'</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap c -&gt; IntMap c -&gt; IntMap c
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap b -&gt; IntMap c
</span><a href="#local-6989586621679186733"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap c
</span><a href="#local-6989586621679186735"><span class="hs-identifier hs-var">g1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b -&gt; IntMap c
</span><a href="#local-6989586621679186734"><span class="hs-identifier hs-var">g2</span></a></span><span>
</span><span id="line-765"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-comment">-- We use the lambda form to avoid non-exhaustive pattern matches warning.</span><span>
</span><span id="line-766"></span><span>        </span><span id="local-6989586621679186733"><span class="annot"><span class="annottext">combine :: IntMap a -&gt; IntMap b -&gt; IntMap c
</span><a href="#local-6989586621679186733"><span class="hs-identifier hs-var hs-var">combine</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186732"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186732"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621679186731"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186731"><span class="hs-identifier hs-var">x1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186730"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186730"><span class="hs-identifier hs-var">_k2</span></a></span></span><span> </span><span id="local-6989586621679186729"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186729"><span class="hs-identifier hs-var">x2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; b -&gt; Maybe c
</span><a href="#local-6989586621679186736"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186732"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186731"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186729"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">Maybe c
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap c
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-767"></span><span>                                                                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186728"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679186728"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; c -&gt; IntMap c
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186732"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679186728"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-768"></span><span>        </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679186733"><span class="hs-pragma hs-type">combine</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-769"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mergeWithKey"><span class="hs-pragma hs-type">mergeWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span class="hs-comment">{--------------------------------------------------------------------
  Min\/Max
--------------------------------------------------------------------}</span><span>
</span><span id="line-774"></span><span>
</span><span id="line-775"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the minimal key.</span><span>
</span><span id="line-776"></span><span class="hs-comment">--</span><span>
</span><span id="line-777"></span><span class="hs-comment">-- &gt; updateMinWithKey (\ k a -&gt; Just ((show k) ++ &quot;:&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3,&quot;3:b&quot;), (5,&quot;a&quot;)]</span><span>
</span><span id="line-778"></span><span class="hs-comment">-- &gt; updateMinWithKey (\ _ _ -&gt; Nothing)                     (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-779"></span><span>
</span><span id="line-780"></span><span id="local-6989586621679187155"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-type">updateMinWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187155"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187155"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187155"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187155"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-781"></span><span id="updateMinWithKey"><span class="annot"><span class="annottext">updateMinWithKey :: forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var hs-var">updateMinWithKey</span></a></span></span><span> </span><span id="local-6989586621679186723"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186723"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186722"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186722"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-782"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186722"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186721"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186721"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186720"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186720"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186719"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186719"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186718"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186718"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186720"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckRight"><span class="hs-identifier hs-var">binCheckRight</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186721"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186720"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186719"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="#local-6989586621679186716"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186723"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186718"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-783"></span><span>            </span><span class="annot"><span class="annottext">IntMap a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="#local-6989586621679186716"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186723"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186722"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-784"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-785"></span><span>    </span><span id="local-6989586621679186716"><span class="annot"><span class="annottext">go :: (Key -&gt; t -&gt; Maybe t) -&gt; IntMap t -&gt; IntMap t
</span><a href="#local-6989586621679186716"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186713"><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186713"><span class="hs-identifier hs-var">f'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186712"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186712"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186711"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186711"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186710"><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186710"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186709"><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186709"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap t -&gt; IntMap t -&gt; IntMap t
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckLeft"><span class="hs-identifier hs-var">binCheckLeft</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186712"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186711"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; t -&gt; Maybe t) -&gt; IntMap t -&gt; IntMap t
</span><a href="#local-6989586621679186716"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186713"><span class="hs-identifier hs-var">f'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186710"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186709"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-786"></span><span>    </span><span class="annot"><a href="#local-6989586621679186716"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679186708"><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186708"><span class="hs-identifier hs-var">f'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186707"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186707"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186706"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186706"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186708"><span class="hs-identifier hs-var">f'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186707"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186706"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-787"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186705"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186705"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; IntMap t
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186707"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186705"><span class="hs-identifier hs-var">y'</span></a></span><span>
</span><span id="line-788"></span><span>                        </span><span class="annot"><span class="annottext">Maybe t
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap t
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-789"></span><span>    </span><span class="annot"><a href="#local-6989586621679186716"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IntMap t
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;updateMinWithKey Nil&quot;</span></span><span>
</span><span id="line-790"></span><span>
</span><span id="line-791"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the maximal key.</span><span>
</span><span id="line-792"></span><span class="hs-comment">--</span><span>
</span><span id="line-793"></span><span class="hs-comment">-- &gt; updateMaxWithKey (\ k a -&gt; Just ((show k) ++ &quot;:&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3,&quot;b&quot;), (5,&quot;5:a&quot;)]</span><span>
</span><span id="line-794"></span><span class="hs-comment">-- &gt; updateMaxWithKey (\ _ _ -&gt; Nothing)                     (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;b&quot;</span><span>
</span><span id="line-795"></span><span>
</span><span id="line-796"></span><span id="local-6989586621679186703"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-type">updateMaxWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186703"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186703"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186703"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186703"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-797"></span><span id="updateMaxWithKey"><span class="annot"><span class="annottext">updateMaxWithKey :: forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var hs-var">updateMaxWithKey</span></a></span></span><span> </span><span id="local-6989586621679186700"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186700"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186699"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186699"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-798"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186699"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186698"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186698"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186697"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186697"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186696"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186696"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186695"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186695"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186697"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckLeft"><span class="hs-identifier hs-var">binCheckLeft</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186698"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186697"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="#local-6989586621679186694"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186700"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186696"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186695"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-799"></span><span>            </span><span class="annot"><span class="annottext">IntMap a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="#local-6989586621679186694"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679186700"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186699"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-800"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-801"></span><span>    </span><span id="local-6989586621679186694"><span class="annot"><span class="annottext">go :: (Key -&gt; t -&gt; Maybe t) -&gt; IntMap t -&gt; IntMap t
</span><a href="#local-6989586621679186694"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186691"><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186691"><span class="hs-identifier hs-var">f'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186690"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186690"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186689"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186689"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186688"><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186688"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186687"><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186687"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap t -&gt; IntMap t -&gt; IntMap t
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#binCheckRight"><span class="hs-identifier hs-var">binCheckRight</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186690"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186689"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186688"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; t -&gt; Maybe t) -&gt; IntMap t -&gt; IntMap t
</span><a href="#local-6989586621679186694"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186691"><span class="hs-identifier hs-var">f'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186687"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-802"></span><span>    </span><span class="annot"><a href="#local-6989586621679186694"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679186686"><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186686"><span class="hs-identifier hs-var">f'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186685"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186685"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186684"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186684"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><a href="#local-6989586621679186686"><span class="hs-identifier hs-var">f'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186685"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186684"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-803"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186683"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186683"><span class="hs-identifier hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; IntMap t
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186685"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186683"><span class="hs-identifier hs-var">y'</span></a></span><span>
</span><span id="line-804"></span><span>                        </span><span class="annot"><span class="annottext">Maybe t
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap t
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-805"></span><span>    </span><span class="annot"><a href="#local-6989586621679186694"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Maybe t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IntMap t
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;updateMaxWithKey Nil&quot;</span></span><span>
</span><span id="line-806"></span><span>
</span><span id="line-807"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the maximal key.</span><span>
</span><span id="line-808"></span><span class="hs-comment">--</span><span>
</span><span id="line-809"></span><span class="hs-comment">-- &gt; updateMax (\ a -&gt; Just (&quot;X&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;Xa&quot;)]</span><span>
</span><span id="line-810"></span><span class="hs-comment">-- &gt; updateMax (\ _ -&gt; Nothing)         (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;b&quot;</span><span>
</span><span id="line-811"></span><span>
</span><span id="line-812"></span><span id="local-6989586621679187146"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMax"><span class="hs-identifier hs-type">updateMax</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187146"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187146"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187146"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187146"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-813"></span><span id="updateMax"><span class="annot"><span class="annottext">updateMax :: forall a. (a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateMax"><span class="hs-identifier hs-var hs-var">updateMax</span></a></span></span><span> </span><span id="local-6989586621679186682"><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679186682"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var">updateMaxWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; Key -&gt; a -&gt; Maybe a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679186682"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-814"></span><span>
</span><span id="line-815"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the minimal key.</span><span>
</span><span id="line-816"></span><span class="hs-comment">--</span><span>
</span><span id="line-817"></span><span class="hs-comment">-- &gt; updateMin (\ a -&gt; Just (&quot;X&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;Xb&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-818"></span><span class="hs-comment">-- &gt; updateMin (\ _ -&gt; Nothing)         (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-819"></span><span>
</span><span id="line-820"></span><span id="local-6989586621679186681"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#updateMin"><span class="hs-identifier hs-type">updateMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186681"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186681"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186681"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186681"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-821"></span><span id="updateMin"><span class="annot"><span class="annottext">updateMin :: forall a. (a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateMin"><span class="hs-identifier hs-var hs-var">updateMin</span></a></span></span><span> </span><span id="local-6989586621679186680"><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679186680"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; Maybe a) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var">updateMinWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; Key -&gt; a -&gt; Maybe a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679186680"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-822"></span><span>
</span><span id="line-823"></span><span>
</span><span id="line-824"></span><span class="hs-comment">{--------------------------------------------------------------------
  Mapping
--------------------------------------------------------------------}</span><span>
</span><span id="line-827"></span><span class="hs-comment">-- | /O(n)/. Map a function over all values in the map.</span><span>
</span><span id="line-828"></span><span class="hs-comment">--</span><span>
</span><span id="line-829"></span><span class="hs-comment">-- &gt; map (++ &quot;x&quot;) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;bx&quot;), (5, &quot;ax&quot;)]</span><span>
</span><span id="line-830"></span><span>
</span><span id="line-831"></span><span id="local-6989586621679187142"><span id="local-6989586621679187143"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-identifier hs-type">map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187143"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187142"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187143"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187142"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-832"></span><span id="map"><span class="annot"><span class="annottext">map :: forall a b. (a -&gt; b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-identifier hs-var hs-var">map</span></a></span></span><span> </span><span id="local-6989586621679186679"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679186679"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap b
</span><a href="#local-6989586621679186678"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-833"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-834"></span><span>    </span><span id="local-6989586621679186678"><span class="annot"><span class="annottext">go :: IntMap a -&gt; IntMap b
</span><a href="#local-6989586621679186678"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186677"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186677"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186676"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186676"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186675"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186675"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186674"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186674"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186677"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186676"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap b
</span><a href="#local-6989586621679186678"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186675"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap b
</span><a href="#local-6989586621679186678"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186674"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-835"></span><span>    </span><span class="annot"><a href="#local-6989586621679186678"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186673"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186673"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186672"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186672"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; b -&gt; IntMap b
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186673"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; IntMap b) -&gt; b -&gt; IntMap b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679186679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186672"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-836"></span><span>    </span><span class="annot"><a href="#local-6989586621679186678"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-cpp">

#ifdef __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-840"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-841"></span><span class="annot"><span class="hs-pragma">&quot;map/map&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186671"><span class="annot"><a href="#local-6989586621679186671"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186670"><span class="annot"><a href="#local-6989586621679186670"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186669"><span class="annot"><a href="#local-6989586621679186669"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186671"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186670"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186669"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186668"><span class="annot"><a href="#local-6989586621679186668"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186671"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186670"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186668"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186669"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-842"></span><span class="annot"><span class="hs-pragma">&quot;map/mapL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186667"><span class="annot"><a href="#local-6989586621679186667"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186666"><span class="annot"><a href="#local-6989586621679186666"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186665"><span class="annot"><a href="#local-6989586621679186665"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186667"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Internal.html#map"><span class="hs-pragma hs-type">L.map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186666"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186665"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186663"><span class="annot"><a href="#local-6989586621679186663"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186667"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679186666"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186663"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186665"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-843"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-846"></span><span class="hs-comment">-- | /O(n)/. Map a function over all values in the map.</span><span>
</span><span id="line-847"></span><span class="hs-comment">--</span><span>
</span><span id="line-848"></span><span class="hs-comment">-- &gt; let f key x = (show key) ++ &quot;:&quot; ++ x</span><span>
</span><span id="line-849"></span><span class="hs-comment">-- &gt; mapWithKey f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;3:b&quot;), (5, &quot;5:a&quot;)]</span><span>
</span><span id="line-850"></span><span>
</span><span id="line-851"></span><span id="local-6989586621679187138"><span id="local-6989586621679187139"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-type">mapWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187139"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187138"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187139"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187138"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-852"></span><span id="mapWithKey"><span class="annot"><span class="annottext">mapWithKey :: forall a b. (Key -&gt; a -&gt; b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var hs-var">mapWithKey</span></a></span></span><span> </span><span id="local-6989586621679186662"><span class="annot"><span class="annottext">Key -&gt; a -&gt; b
</span><a href="#local-6989586621679186662"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186661"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186661"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-853"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186661"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-854"></span><span>      </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186660"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186660"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186659"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186659"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186658"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186658"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186657"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186657"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186660"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186659"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; b) -&gt; IntMap a -&gt; IntMap b
forall a b. (Key -&gt; a -&gt; b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var">mapWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; b
</span><a href="#local-6989586621679186662"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186658"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; b) -&gt; IntMap a -&gt; IntMap b
forall a b. (Key -&gt; a -&gt; b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var">mapWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; b
</span><a href="#local-6989586621679186662"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186657"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-855"></span><span>      </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186656"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186656"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186655"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186655"><span class="hs-identifier hs-var">x</span></a></span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; b -&gt; IntMap b
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186656"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; IntMap b) -&gt; b -&gt; IntMap b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; b
</span><a href="#local-6989586621679186662"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186656"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186655"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-856"></span><span>      </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-cpp">

#ifdef __GLASGOW_HASKELL__
</span><span class="hs-comment">-- Pay close attention to strictness here. We need to force the</span><span>
</span><span id="line-860"></span><span class="hs-comment">-- intermediate result for map f . map g, and we need to refrain</span><span>
</span><span id="line-861"></span><span class="hs-comment">-- from forcing it for map f . L.map g, etc.</span><span>
</span><span id="line-862"></span><span class="hs-comment">--</span><span>
</span><span id="line-863"></span><span class="hs-comment">-- TODO Consider moving map and mapWithKey to IntMap.Internal so we can write</span><span>
</span><span id="line-864"></span><span class="hs-comment">-- non-orphan RULES for things like L.map f (map g xs). We'd need a new function</span><span>
</span><span id="line-865"></span><span class="hs-comment">-- for this, and we'd have to pay attention to simplifier phases. Something like</span><span>
</span><span id="line-866"></span><span class="hs-comment">--</span><span>
</span><span id="line-867"></span><span class="hs-comment">-- lsmap :: (b -&gt; c) -&gt; (a -&gt; b) -&gt; IntMap a -&gt; IntMap c</span><span>
</span><span id="line-868"></span><span class="hs-comment">-- lsmap _ _ Nil = Nil</span><span>
</span><span id="line-869"></span><span class="hs-comment">-- lsmap f g (Tip k x) = let !gx = g x in Tip k (f gx)</span><span>
</span><span id="line-870"></span><span class="hs-comment">-- lsmap f g (Bin p m l r) = Bin p m (lsmap f g l) (lsmap f g r)</span><span>
</span><span id="line-871"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-872"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-873"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/mapWithKey&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186654"><span class="annot"><a href="#local-6989586621679186654"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186653"><span class="annot"><a href="#local-6989586621679186653"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186652"><span class="annot"><a href="#local-6989586621679186652"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186654"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186653"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186652"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-874"></span><span>  </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186651"><span class="annot"><a href="#local-6989586621679186651"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186650"><span class="annot"><a href="#local-6989586621679186650"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186654"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186651"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186653"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186651"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186650"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186652"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-875"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/mapWithKeyL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186649"><span class="annot"><a href="#local-6989586621679186649"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186648"><span class="annot"><a href="#local-6989586621679186648"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186647"><span class="annot"><a href="#local-6989586621679186647"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186649"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Internal.html#mapWithKey"><span class="hs-pragma hs-type">L.mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186648"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186647"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-876"></span><span>  </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186645"><span class="annot"><a href="#local-6989586621679186645"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186644"><span class="annot"><a href="#local-6989586621679186644"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186649"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186645"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679186648"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186645"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186644"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186647"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-877"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/map&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186643"><span class="annot"><a href="#local-6989586621679186643"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186642"><span class="annot"><a href="#local-6989586621679186642"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186641"><span class="annot"><a href="#local-6989586621679186641"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186643"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186642"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186641"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-878"></span><span>  </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186640"><span class="annot"><a href="#local-6989586621679186640"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186639"><span class="annot"><a href="#local-6989586621679186639"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186643"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186640"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186642"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186639"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186641"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-879"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/mapL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186638"><span class="annot"><a href="#local-6989586621679186638"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186637"><span class="annot"><a href="#local-6989586621679186637"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186636"><span class="annot"><a href="#local-6989586621679186636"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186638"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Internal.html#map"><span class="hs-pragma hs-type">L.map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186637"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186636"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-880"></span><span>  </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186635"><span class="annot"><a href="#local-6989586621679186635"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186634"><span class="annot"><a href="#local-6989586621679186634"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186638"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186635"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679186637"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186634"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186636"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-881"></span><span class="annot"><span class="hs-pragma">&quot;map/mapWithKey&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186633"><span class="annot"><a href="#local-6989586621679186633"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186632"><span class="annot"><a href="#local-6989586621679186632"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186631"><span class="annot"><a href="#local-6989586621679186631"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186633"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186632"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186631"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-882"></span><span>  </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186630"><span class="annot"><a href="#local-6989586621679186630"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186629"><span class="annot"><a href="#local-6989586621679186629"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186633"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186632"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186630"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186629"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186631"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-883"></span><span class="annot"><span class="hs-pragma">&quot;map/mapWithKeyL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679186628"><span class="annot"><a href="#local-6989586621679186628"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186627"><span class="annot"><a href="#local-6989586621679186627"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679186626"><span class="annot"><a href="#local-6989586621679186626"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186628"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.IntMap.Internal.html#mapWithKey"><span class="hs-pragma hs-type">L.mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186627"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186626"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-884"></span><span>  </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679186625"><span class="annot"><a href="#local-6989586621679186625"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186624"><span class="annot"><a href="#local-6989586621679186624"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186628"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679186627"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186625"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186624"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679186626"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-885"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-888"></span><span class="hs-comment">-- | /O(n)/.</span><span>
</span><span id="line-889"></span><span class="hs-comment">-- @'traverseWithKey' f s == 'fromList' &lt;$&gt; 'traverse' (\(k, v) -&gt; (,) k &lt;$&gt; f k v) ('toList' m)@</span><span>
</span><span id="line-890"></span><span class="hs-comment">-- That is, behaves exactly like a regular 'traverse' except that the traversing</span><span>
</span><span id="line-891"></span><span class="hs-comment">-- function also has access to the key associated with a value.</span><span>
</span><span id="line-892"></span><span class="hs-comment">--</span><span>
</span><span id="line-893"></span><span class="hs-comment">-- &gt; traverseWithKey (\k v -&gt; if odd k then Just (succ v) else Nothing) (fromList [(1, 'a'), (5, 'e')]) == Just (fromList [(1, 'b'), (5, 'f')])</span><span>
</span><span id="line-894"></span><span class="hs-comment">-- &gt; traverseWithKey (\k v -&gt; if odd k then Just (succ v) else Nothing) (fromList [(2, 'c')])           == Nothing</span><span>
</span><span id="line-895"></span><span id="local-6989586621679187133"><span id="local-6989586621679187134"><span id="local-6989586621679187135"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#traverseWithKey"><span class="hs-identifier hs-type">traverseWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187135"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187134"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187135"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187133"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187134"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187135"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187133"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-896"></span><span id="traverseWithKey"><span class="annot"><span class="annottext">traverseWithKey :: forall (t :: * -&gt; *) a b.
Applicative t =&gt;
(Key -&gt; a -&gt; t b) -&gt; IntMap a -&gt; t (IntMap b)
</span><a href="Data.IntMap.Strict.Internal.html#traverseWithKey"><span class="hs-identifier hs-var hs-var">traverseWithKey</span></a></span></span><span> </span><span id="local-6989586621679186620"><span class="annot"><span class="annottext">Key -&gt; a -&gt; t b
</span><a href="#local-6989586621679186620"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; t (IntMap b)
</span><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-897"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-898"></span><span>    </span><span id="local-6989586621679186619"><span class="annot"><span class="annottext">go :: IntMap a -&gt; t (IntMap b)
</span><a href="#local-6989586621679186619"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap b -&gt; t (IntMap b)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-899"></span><span>    </span><span class="annot"><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186612"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186612"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186611"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186611"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186610"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186610"><span class="hs-identifier hs-var">v'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; b -&gt; IntMap b
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186612"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186610"><span class="hs-identifier hs-var">v'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(b -&gt; IntMap b) -&gt; t b -&gt; t (IntMap b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; t b
</span><a href="#local-6989586621679186620"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186612"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186611"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-900"></span><span>    </span><span class="annot"><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186609"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186609"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186608"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186608"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186607"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186607"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186606"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186606"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-901"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186608"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap b -&gt; IntMap b -&gt; IntMap b)
-&gt; t (IntMap b) -&gt; t (IntMap b) -&gt; t (IntMap b)
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(IntMap b -&gt; IntMap b -&gt; IntMap b)
-&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186609"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186608"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; t (IntMap b)
</span><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186606"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; t (IntMap b)
</span><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186607"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-902"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap b -&gt; IntMap b -&gt; IntMap b)
-&gt; t (IntMap b) -&gt; t (IntMap b) -&gt; t (IntMap b)
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186609"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186608"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; t (IntMap b)
</span><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186607"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; t (IntMap b)
</span><a href="#local-6989586621679186619"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186606"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-903"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#traverseWithKey"><span class="hs-pragma hs-type">traverseWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-904"></span><span>
</span><span id="line-905"></span><span class="hs-comment">-- | /O(n)/. Traverse keys\/values and collect the 'Just' results.</span><span>
</span><span id="line-906"></span><span class="hs-comment">--</span><span>
</span><span id="line-907"></span><span class="hs-comment">-- @since 0.6.4</span><span>
</span><span id="line-908"></span><span id="local-6989586621679187119"><span id="local-6989586621679187120"><span id="local-6989586621679187121"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier hs-type">traverseMaybeWithKey</span></a></span><span>
</span><span id="line-909"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187121"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187120"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187121"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187119"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187120"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187121"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187119"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-910"></span><span id="traverseMaybeWithKey"><span class="annot"><span class="annottext">traverseMaybeWithKey :: forall (f :: * -&gt; *) a b.
Applicative f =&gt;
(Key -&gt; a -&gt; f (Maybe b)) -&gt; IntMap a -&gt; f (IntMap b)
</span><a href="Data.IntMap.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier hs-var hs-var">traverseMaybeWithKey</span></a></span></span><span> </span><span id="local-6989586621679186602"><span class="annot"><span class="annottext">Key -&gt; a -&gt; f (Maybe b)
</span><a href="#local-6989586621679186602"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; f (IntMap b)
</span><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-911"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-912"></span><span>    </span><span id="local-6989586621679186601"><span class="annot"><span class="annottext">go :: IntMap a -&gt; f (IntMap b)
</span><a href="#local-6989586621679186601"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap b -&gt; f (IntMap b)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-913"></span><span>    </span><span class="annot"><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186594"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186594"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186593"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186593"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap b -&gt; (b -&gt; IntMap b) -&gt; Maybe b -&gt; IntMap b
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; b -&gt; IntMap b
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186594"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; IntMap b) -&gt; b -&gt; IntMap b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Maybe b -&gt; IntMap b) -&gt; f (Maybe b) -&gt; f (IntMap b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; f (Maybe b)
</span><a href="#local-6989586621679186602"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186594"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186593"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-914"></span><span>    </span><span class="annot"><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186592"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186592"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186591"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186591"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186590"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186590"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186589"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186589"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-915"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186591"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap b -&gt; IntMap b -&gt; IntMap b)
-&gt; f (IntMap b) -&gt; f (IntMap b) -&gt; f (IntMap b)
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(IntMap b -&gt; IntMap b -&gt; IntMap b)
-&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186592"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186591"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; f (IntMap b)
</span><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186589"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; f (IntMap b)
</span><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186590"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-916"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap b -&gt; IntMap b -&gt; IntMap b)
-&gt; f (IntMap b) -&gt; f (IntMap b) -&gt; f (IntMap b)
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186592"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186591"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; f (IntMap b)
</span><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186590"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a -&gt; f (IntMap b)
</span><a href="#local-6989586621679186601"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186589"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-917"></span><span>
</span><span id="line-918"></span><span class="hs-comment">-- | /O(n)/. The function @'mapAccum'@ threads an accumulating</span><span>
</span><span id="line-919"></span><span class="hs-comment">-- argument through the map in ascending order of keys.</span><span>
</span><span id="line-920"></span><span class="hs-comment">--</span><span>
</span><span id="line-921"></span><span class="hs-comment">-- &gt; let f a b = (a ++ b, b ++ &quot;X&quot;)</span><span>
</span><span id="line-922"></span><span class="hs-comment">-- &gt; mapAccum f &quot;Everything: &quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (&quot;Everything: ba&quot;, fromList [(3, &quot;bX&quot;), (5, &quot;aX&quot;)])</span><span>
</span><span id="line-923"></span><span>
</span><span id="line-924"></span><span id="local-6989586621679187113"><span id="local-6989586621679187114"><span id="local-6989586621679187115"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccum"><span class="hs-identifier hs-type">mapAccum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187115"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187114"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187115"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187113"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187115"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187114"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187115"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187113"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-925"></span><span id="mapAccum"><span class="annot"><span class="annottext">mapAccum :: forall a b c. (a -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapAccum"><span class="hs-identifier hs-var hs-var">mapAccum</span></a></span></span><span> </span><span id="local-6989586621679186588"><span class="annot"><span class="annottext">a -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186588"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
forall a b c.
(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier hs-var">mapAccumWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679186587"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186587"><span class="hs-identifier hs-var">a'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186586"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186586"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186588"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186587"><span class="hs-identifier hs-var">a'</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186586"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-926"></span><span>
</span><span id="line-927"></span><span class="hs-comment">-- | /O(n)/. The function @'mapAccumWithKey'@ threads an accumulating</span><span>
</span><span id="line-928"></span><span class="hs-comment">-- argument through the map in ascending order of keys.</span><span>
</span><span id="line-929"></span><span class="hs-comment">--</span><span>
</span><span id="line-930"></span><span class="hs-comment">-- &gt; let f a k b = (a ++ &quot; &quot; ++ (show k) ++ &quot;-&quot; ++ b, b ++ &quot;X&quot;)</span><span>
</span><span id="line-931"></span><span class="hs-comment">-- &gt; mapAccumWithKey f &quot;Everything:&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (&quot;Everything: 3-b 5-a&quot;, fromList [(3, &quot;bX&quot;), (5, &quot;aX&quot;)])</span><span>
</span><span id="line-932"></span><span>
</span><span id="line-933"></span><span id="local-6989586621679187107"><span id="local-6989586621679187108"><span id="local-6989586621679187109"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier hs-type">mapAccumWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187109"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187108"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187109"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187107"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187109"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187108"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187109"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187107"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-934"></span><span id="mapAccumWithKey"><span class="annot"><span class="annottext">mapAccumWithKey :: forall a b c.
(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier hs-var hs-var">mapAccumWithKey</span></a></span></span><span> </span><span id="local-6989586621679186585"><span class="annot"><span class="annottext">a -&gt; Key -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186585"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186584"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186584"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679186583"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186583"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-935"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
forall a b c.
(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186585"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186584"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186583"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-936"></span><span>
</span><span id="line-937"></span><span class="hs-comment">-- | /O(n)/. The function @'mapAccumL'@ threads an accumulating</span><span>
</span><span id="line-938"></span><span class="hs-comment">-- argument through the map in ascending order of keys.  Strict in</span><span>
</span><span id="line-939"></span><span class="hs-comment">-- the accumulating argument and the both elements of the</span><span>
</span><span id="line-940"></span><span class="hs-comment">-- result of the function.</span><span>
</span><span id="line-941"></span><span id="local-6989586621679186579"><span id="local-6989586621679186580"><span id="local-6989586621679186581"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-type">mapAccumL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186581"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186580"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186581"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679186579"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186581"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186580"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186581"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186579"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-942"></span><span id="mapAccumL"><span class="annot"><span class="annottext">mapAccumL :: forall a b c.
(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var hs-var">mapAccumL</span></a></span></span><span> </span><span id="local-6989586621679186578"><span class="annot"><span class="annottext">a -&gt; Key -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186578"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span id="local-6989586621679186577"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186577"><span class="hs-identifier hs-var">a0</span></a></span></span><span> </span><span id="local-6989586621679186576"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186576"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair a (IntMap c) -&gt; (a, IntMap c)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair a (IntMap c) -&gt; (a, IntMap c))
-&gt; StrictPair a (IntMap c) -&gt; (a, IntMap c)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; b -&gt; (a, c))
-&gt; a -&gt; IntMap b -&gt; StrictPair a (IntMap c)
forall {a} {a} {a}.
(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186575"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186578"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186577"><span class="hs-identifier hs-var">a0</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186576"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-943"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-944"></span><span>    </span><span id="local-6989586621679186575"><span class="annot"><span class="annottext">go :: (a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186575"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186572"><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186572"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186571"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186571"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679186570"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186570"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-945"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186570"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-946"></span><span>          </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186569"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186569"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186568"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186568"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186567"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186567"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186566"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186566"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-947"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186568"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-948"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186565"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186565"><span class="hs-identifier hs-var">a1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186564"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186564"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186575"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186572"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186571"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186566"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-949"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621679186563"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186563"><span class="hs-identifier hs-var">a2</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186562"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186562"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186575"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186572"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186565"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186567"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-950"></span><span>                </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186563"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186569"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186568"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186562"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186564"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-951"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-952"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186561"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186561"><span class="hs-identifier hs-var">a1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186560"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186560"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186575"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186572"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186571"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186567"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-953"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621679186559"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186559"><span class="hs-identifier hs-var">a2</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186558"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186558"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186575"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186572"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186561"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186566"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-954"></span><span>                </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186559"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186569"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186568"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186560"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186558"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-955"></span><span>          </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186557"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186557"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186556"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186556"><span class="hs-identifier hs-var">x</span></a></span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679186555"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186555"><span class="hs-identifier hs-var">a'</span></a></span></span><span class="hs-special">,</span><span class="hs-glyph">!</span><span id="local-6989586621679186554"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186554"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186572"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186571"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186557"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186556"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186555"><span class="hs-identifier hs-var">a'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186557"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186554"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-956"></span><span>          </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186571"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-957"></span><span>
</span><span id="line-958"></span><span class="hs-comment">-- | /O(n)/. The function @'mapAccumRWithKey'@ threads an accumulating</span><span>
</span><span id="line-959"></span><span class="hs-comment">-- argument through the map in descending order of keys.</span><span>
</span><span id="line-960"></span><span id="local-6989586621679186551"><span id="local-6989586621679186552"><span id="local-6989586621679186553"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-type">mapAccumRWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186553"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186552"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186553"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679186551"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186553"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186552"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186553"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186551"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-961"></span><span id="mapAccumRWithKey"><span class="annot"><span class="annottext">mapAccumRWithKey :: forall a b c.
(a -&gt; Key -&gt; b -&gt; (a, c)) -&gt; a -&gt; IntMap b -&gt; (a, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-var hs-var">mapAccumRWithKey</span></a></span></span><span> </span><span id="local-6989586621679186550"><span class="annot"><span class="annottext">a -&gt; Key -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186550"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span id="local-6989586621679186549"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186549"><span class="hs-identifier hs-var">a0</span></a></span></span><span> </span><span id="local-6989586621679186548"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186548"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair a (IntMap c) -&gt; (a, IntMap c)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair a (IntMap c) -&gt; (a, IntMap c))
-&gt; StrictPair a (IntMap c) -&gt; (a, IntMap c)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; b -&gt; (a, c))
-&gt; a -&gt; IntMap b -&gt; StrictPair a (IntMap c)
forall {a} {a} {a}.
(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186547"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679186550"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186549"><span class="hs-identifier hs-var">a0</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621679186548"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-962"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-963"></span><span>    </span><span id="local-6989586621679186547"><span class="annot"><span class="annottext">go :: (a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186547"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186544"><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186544"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186543"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186543"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679186542"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186542"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-964"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186542"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-965"></span><span>          </span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186541"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186541"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186540"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186540"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186539"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186539"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186538"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186538"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-966"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186540"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-967"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186537"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186537"><span class="hs-identifier hs-var">a1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186536"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186536"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186547"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186543"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186539"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-968"></span><span>                  </span><span class="hs-special">(</span><span id="local-6989586621679186535"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186535"><span class="hs-identifier hs-var">a2</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186534"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186534"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186547"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186537"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186538"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-969"></span><span>              </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186535"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186541"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186540"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186536"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186534"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-970"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-971"></span><span>              </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186533"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186533"><span class="hs-identifier hs-var">a1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186532"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186532"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186547"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186543"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186538"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-972"></span><span>                  </span><span class="hs-special">(</span><span id="local-6989586621679186531"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186531"><span class="hs-identifier hs-var">a2</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186530"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186530"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Key -&gt; a -&gt; (a, a))
-&gt; a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
</span><a href="#local-6989586621679186547"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186533"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186539"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-973"></span><span>              </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186531"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186541"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186540"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186530"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186532"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-974"></span><span>          </span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186529"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186529"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186528"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186528"><span class="hs-identifier hs-var">x</span></a></span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679186527"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186527"><span class="hs-identifier hs-var">a'</span></a></span></span><span class="hs-special">,</span><span class="hs-glyph">!</span><span id="local-6989586621679186526"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186526"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Key -&gt; a -&gt; (a, a)
</span><a href="#local-6989586621679186544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186543"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186529"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186528"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186527"><span class="hs-identifier hs-var">a'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186529"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186526"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-975"></span><span>          </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186543"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; IntMap a -&gt; StrictPair a (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-976"></span><span>
</span><span id="line-977"></span><span class="hs-comment">-- | /O(n*log n)/.</span><span>
</span><span id="line-978"></span><span class="hs-comment">-- @'mapKeysWith' c f s@ is the map obtained by applying @f@ to each key of @s@.</span><span>
</span><span id="line-979"></span><span class="hs-comment">--</span><span>
</span><span id="line-980"></span><span class="hs-comment">-- The size of the result may be smaller if @f@ maps two or more distinct</span><span>
</span><span id="line-981"></span><span class="hs-comment">-- keys to the same new key.  In this case the associated values will be</span><span>
</span><span id="line-982"></span><span class="hs-comment">-- combined using @c@.</span><span>
</span><span id="line-983"></span><span class="hs-comment">--</span><span>
</span><span id="line-984"></span><span class="hs-comment">-- &gt; mapKeysWith (++) (\ _ -&gt; 1) (fromList [(1,&quot;b&quot;), (2,&quot;a&quot;), (3,&quot;d&quot;), (4,&quot;c&quot;)]) == singleton 1 &quot;cdab&quot;</span><span>
</span><span id="line-985"></span><span class="hs-comment">-- &gt; mapKeysWith (++) (\ _ -&gt; 3) (fromList [(1,&quot;b&quot;), (2,&quot;a&quot;), (3,&quot;d&quot;), (4,&quot;c&quot;)]) == singleton 3 &quot;cdab&quot;</span><span>
</span><span id="line-986"></span><span>
</span><span id="line-987"></span><span id="local-6989586621679187091"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapKeysWith"><span class="hs-identifier hs-type">mapKeysWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187091"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187091"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187091"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187091"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187091"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-988"></span><span id="mapKeysWith"><span class="annot"><span class="annottext">mapKeysWith :: forall a. (a -&gt; a -&gt; a) -&gt; (Key -&gt; Key) -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#mapKeysWith"><span class="hs-identifier hs-var hs-var">mapKeysWith</span></a></span></span><span> </span><span id="local-6989586621679186525"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186525"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679186524"><span class="annot"><span class="annottext">Key -&gt; Key
</span><a href="#local-6989586621679186524"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
forall a. (a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromListWith"><span class="hs-identifier hs-var">fromListWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186525"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">([(Key, a)] -&gt; IntMap a)
-&gt; (IntMap a -&gt; [(Key, a)]) -&gt; IntMap a -&gt; IntMap a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; [(Key, a)] -&gt; [(Key, a)])
-&gt; [(Key, a)] -&gt; IntMap a -&gt; [(Key, a)]
forall a b. (Key -&gt; a -&gt; b -&gt; b) -&gt; b -&gt; IntMap a -&gt; b
</span><a href="Data.IntMap.Internal.html#foldrWithKey"><span class="hs-identifier hs-var">foldrWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679186522"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186522"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186521"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186521"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186520"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186520"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key
</span><a href="#local-6989586621679186524"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186522"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186521"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Key, a) -&gt; [(Key, a)] -&gt; [(Key, a)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186520"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-989"></span><span>
</span><span id="line-990"></span><span class="hs-comment">{--------------------------------------------------------------------
  Filter
--------------------------------------------------------------------}</span><span>
</span><span id="line-993"></span><span class="hs-comment">-- | /O(n)/. Map values and collect the 'Just' results.</span><span>
</span><span id="line-994"></span><span class="hs-comment">--</span><span>
</span><span id="line-995"></span><span class="hs-comment">-- &gt; let f x = if x == &quot;a&quot; then Just &quot;new a&quot; else Nothing</span><span>
</span><span id="line-996"></span><span class="hs-comment">-- &gt; mapMaybe f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;new a&quot;</span><span>
</span><span id="line-997"></span><span>
</span><span id="line-998"></span><span id="local-6989586621679187082"><span id="local-6989586621679187083"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapMaybe"><span class="hs-identifier hs-type">mapMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187083"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187082"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187083"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187082"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-999"></span><span id="mapMaybe"><span class="annot"><span class="annottext">mapMaybe :: forall a b. (a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapMaybe"><span class="hs-identifier hs-var hs-var">mapMaybe</span></a></span></span><span> </span><span id="local-6989586621679186519"><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621679186519"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
forall a b. (Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186518"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186518"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621679186519"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186518"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1000"></span><span>
</span><span id="line-1001"></span><span class="hs-comment">-- | /O(n)/. Map keys\/values and collect the 'Just' results.</span><span>
</span><span id="line-1002"></span><span class="hs-comment">--</span><span>
</span><span id="line-1003"></span><span class="hs-comment">-- &gt; let f k _ = if k &lt; 5 then Just (&quot;key : &quot; ++ (show k)) else Nothing</span><span>
</span><span id="line-1004"></span><span class="hs-comment">-- &gt; mapMaybeWithKey f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;key : 3&quot;</span><span>
</span><span id="line-1005"></span><span>
</span><span id="line-1006"></span><span id="local-6989586621679187078"><span id="local-6989586621679187079"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-type">mapMaybeWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187079"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187078"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187079"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187078"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-1007"></span><span id="mapMaybeWithKey"><span class="annot"><span class="annottext">mapMaybeWithKey :: forall a b. (Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var hs-var">mapMaybeWithKey</span></a></span></span><span> </span><span id="local-6989586621679186517"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679186517"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186516"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186516"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186515"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186515"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186514"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186514"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186513"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186513"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1008"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap b -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186516"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186515"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
forall a b. (Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679186517"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186514"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
forall a b. (Key -&gt; a -&gt; Maybe b) -&gt; IntMap a -&gt; IntMap b
</span><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679186517"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186513"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1009"></span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span id="local-6989586621679186512"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679186512"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186511"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186511"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186510"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186510"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679186512"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186511"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186510"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1010"></span><span>  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186509"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186509"><span class="hs-identifier hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; b -&gt; IntMap b
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186511"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679186509"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1011"></span><span>  </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-1012"></span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Maybe b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap b
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-1013"></span><span>
</span><span id="line-1014"></span><span class="hs-comment">-- | /O(n)/. Map values and separate the 'Left' and 'Right' results.</span><span>
</span><span id="line-1015"></span><span class="hs-comment">--</span><span>
</span><span id="line-1016"></span><span class="hs-comment">-- &gt; let f a = if a &lt; &quot;c&quot; then Left a else Right a</span><span>
</span><span id="line-1017"></span><span class="hs-comment">-- &gt; mapEither f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1018"></span><span class="hs-comment">-- &gt;     == (fromList [(3,&quot;b&quot;), (5,&quot;a&quot;)], fromList [(1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1019"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-1020"></span><span class="hs-comment">-- &gt; mapEither (\ a -&gt; Right a) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1021"></span><span class="hs-comment">-- &gt;     == (empty, fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1022"></span><span>
</span><span id="line-1023"></span><span id="local-6989586621679187073"><span id="local-6989586621679187074"><span id="local-6989586621679187075"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapEither"><span class="hs-identifier hs-type">mapEither</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187075"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187074"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187073"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187075"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187074"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187073"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-1024"></span><span id="mapEither"><span class="annot"><span class="annottext">mapEither :: forall a b c. (a -&gt; Either b c) -&gt; IntMap a -&gt; (IntMap b, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapEither"><span class="hs-identifier hs-var hs-var">mapEither</span></a></span></span><span> </span><span id="local-6989586621679186508"><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621679186508"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186507"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186507"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-1025"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Either b c) -&gt; IntMap a -&gt; (IntMap b, IntMap c)
forall a b c.
(Key -&gt; a -&gt; Either b c) -&gt; IntMap a -&gt; (IntMap b, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier hs-var">mapEitherWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186506"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186506"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621679186508"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186506"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186507"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1026"></span><span>
</span><span id="line-1027"></span><span class="hs-comment">-- | /O(n)/. Map keys\/values and separate the 'Left' and 'Right' results.</span><span>
</span><span id="line-1028"></span><span class="hs-comment">--</span><span>
</span><span id="line-1029"></span><span class="hs-comment">-- &gt; let f k a = if k &lt; 5 then Left (k * 2) else Right (a ++ a)</span><span>
</span><span id="line-1030"></span><span class="hs-comment">-- &gt; mapEitherWithKey f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1031"></span><span class="hs-comment">-- &gt;     == (fromList [(1,2), (3,6)], fromList [(5,&quot;aa&quot;), (7,&quot;zz&quot;)])</span><span>
</span><span id="line-1032"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-1033"></span><span class="hs-comment">-- &gt; mapEitherWithKey (\_ a -&gt; Right a) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1034"></span><span class="hs-comment">-- &gt;     == (empty, fromList [(1,&quot;x&quot;), (3,&quot;b&quot;), (5,&quot;a&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1035"></span><span>
</span><span id="line-1036"></span><span id="local-6989586621679187067"><span id="local-6989586621679187068"><span id="local-6989586621679187069"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier hs-type">mapEitherWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187069"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187068"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187067"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187069"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187068"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187067"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-1037"></span><span id="mapEitherWithKey"><span class="annot"><span class="annottext">mapEitherWithKey :: forall a b c.
(Key -&gt; a -&gt; Either b c) -&gt; IntMap a -&gt; (IntMap b, IntMap c)
</span><a href="Data.IntMap.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier hs-var hs-var">mapEitherWithKey</span></a></span></span><span> </span><span id="local-6989586621679186505"><span class="annot"><span class="annottext">Key -&gt; a -&gt; Either b c
</span><a href="#local-6989586621679186505"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span id="local-6989586621679186504"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186504"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (IntMap b) (IntMap c) -&gt; (IntMap b, IntMap c)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (IntMap b) (IntMap c) -&gt; (IntMap b, IntMap c))
-&gt; StrictPair (IntMap b) (IntMap c) -&gt; (IntMap b, IntMap c)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; Either b c)
-&gt; IntMap a -&gt; StrictPair (IntMap b) (IntMap c)
forall {t} {a} {a}.
(Key -&gt; t -&gt; Either a a)
-&gt; IntMap t -&gt; StrictPair (IntMap a) (IntMap a)
</span><a href="#local-6989586621679186503"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; Either b c
</span><a href="#local-6989586621679186505"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186504"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-1038"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1039"></span><span>    </span><span id="local-6989586621679186503"><span class="annot"><span class="annottext">go :: (Key -&gt; t -&gt; Either a a)
-&gt; IntMap t -&gt; StrictPair (IntMap a) (IntMap a)
</span><a href="#local-6989586621679186503"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679186502"><span class="annot"><span class="annottext">Key -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679186502"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679186501"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186501"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186500"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186500"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186499"><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186499"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186498"><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186498"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1040"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186501"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186500"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186497"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186496"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a -&gt; StrictPair (IntMap a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#bin"><span class="hs-identifier hs-var">bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186501"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186500"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186495"><span class="hs-identifier hs-var">l2</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186494"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-1041"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1042"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679186497"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186497"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186495"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186495"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; t -&gt; Either a a)
-&gt; IntMap t -&gt; StrictPair (IntMap a) (IntMap a)
</span><a href="#local-6989586621679186503"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679186502"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186499"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1043"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679186496"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186496"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679186494"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186494"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; t -&gt; Either a a)
-&gt; IntMap t -&gt; StrictPair (IntMap a) (IntMap a)
</span><a href="#local-6989586621679186503"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679186502"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="#local-6989586621679186498"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1044"></span><span>    </span><span class="annot"><a href="#local-6989586621679186503"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679186493"><span class="annot"><span class="annottext">Key -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679186493"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-type">Tip</span></a></span><span> </span><span id="local-6989586621679186492"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186492"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679186491"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186491"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679186493"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186492"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679186491"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1045"></span><span>      </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186490"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186490"><span class="hs-identifier hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186492"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186490"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a -&gt; StrictPair (IntMap a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1046"></span><span>      </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186489"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186489"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a -&gt; StrictPair (IntMap a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186492"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186489"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1047"></span><span>    </span><span class="annot"><a href="#local-6989586621679186503"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; t -&gt; Either a a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">IntMap t
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; IntMap a -&gt; StrictPair (IntMap a) (IntMap a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1048"></span><span>
</span><span id="line-1049"></span><span class="hs-comment">{--------------------------------------------------------------------
  Conversions
--------------------------------------------------------------------}</span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span class="hs-comment">-- | /O(n)/. Build a map from a set of keys and a function which for each key</span><span>
</span><span id="line-1054"></span><span class="hs-comment">-- computes its value.</span><span>
</span><span id="line-1055"></span><span class="hs-comment">--</span><span>
</span><span id="line-1056"></span><span class="hs-comment">-- &gt; fromSet (\k -&gt; replicate k 'a') (Data.IntSet.fromList [3, 5]) == fromList [(5,&quot;aaaaa&quot;), (3,&quot;aaa&quot;)]</span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- &gt; fromSet undefined Data.IntSet.empty == empty</span><span>
</span><span id="line-1058"></span><span>
</span><span id="line-1059"></span><span id="local-6989586621679187060"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier hs-type">fromSet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187060"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntSet.Internal.html#IntSet"><span class="hs-identifier hs-type">IntSet.IntSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187060"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1060"></span><span id="fromSet"><span class="annot"><span class="annottext">fromSet :: forall a. (Key -&gt; a) -&gt; IntSet -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var hs-var">fromSet</span></a></span></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">IntSet
</span><a href="Data.IntSet.Internal.html#Nil"><span class="hs-identifier hs-var">IntSet.Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-1061"></span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span id="local-6989586621679186485"><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186485"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Bin"><span class="hs-identifier hs-type">IntSet.Bin</span></a></span><span> </span><span id="local-6989586621679186483"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186483"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679186482"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186482"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679186481"><span class="annot"><span class="annottext">IntSet
</span><a href="#local-6989586621679186481"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679186480"><span class="annot"><span class="annottext">IntSet
</span><a href="#local-6989586621679186480"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186483"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186482"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; IntSet -&gt; IntMap a
forall a. (Key -&gt; a) -&gt; IntSet -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186485"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntSet
</span><a href="#local-6989586621679186481"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; IntSet -&gt; IntMap a
forall a. (Key -&gt; a) -&gt; IntSet -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186485"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntSet
</span><a href="#local-6989586621679186480"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1062"></span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span id="local-6989586621679186479"><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186479"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Tip"><span class="hs-identifier hs-type">IntSet.Tip</span></a></span><span> </span><span id="local-6989586621679186477"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186477"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186476"><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186476"><span class="hs-identifier hs-var">bm</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
forall {a}. (Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
</span><a href="#local-6989586621679186475"><span class="hs-identifier hs-var">buildTree</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186479"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186477"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186476"><span class="hs-identifier hs-var">bm</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key
</span><a href="Data.IntSet.Internal.html#suffixBitMask"><span class="hs-identifier hs-var">IntSet.suffixBitMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1063"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-comment">-- This is slightly complicated, as we to convert the dense</span><span>
</span><span id="line-1064"></span><span>        </span><span class="hs-comment">-- representation of IntSet into tree representation of IntMap.</span><span>
</span><span id="line-1065"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-1066"></span><span>        </span><span class="hs-comment">-- We are given a nonzero bit mask 'bmask' of 'bits' bits with prefix 'prefix'.</span><span>
</span><span id="line-1067"></span><span>        </span><span class="hs-comment">-- We split bmask into halves corresponding to left and right subtree.</span><span>
</span><span id="line-1068"></span><span>        </span><span class="hs-comment">-- If they are both nonempty, we create a Bin node, otherwise exactly</span><span>
</span><span id="line-1069"></span><span>        </span><span class="hs-comment">-- one of them is nonempty and we construct the IntMap from that half.</span><span>
</span><span id="line-1070"></span><span>        </span><span id="local-6989586621679186475"><span class="annot"><span class="annottext">buildTree :: (Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
</span><a href="#local-6989586621679186475"><span class="hs-identifier hs-var hs-var">buildTree</span></a></span></span><span> </span><span id="local-6989586621679186455"><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186455"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186454"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186453"><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span></span><span> </span><span id="local-6989586621679186452"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186452"><span class="hs-identifier hs-var">bits</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186452"><span class="hs-identifier hs-var">bits</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1071"></span><span>          </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186455"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span>
</span><span id="line-1072"></span><span>          </span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key
</span><a href="Data.IntMap.Internal.html#intFromNat"><span class="hs-identifier hs-var">intFromNat</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; BitMap
</span><a href="Data.IntMap.Internal.html#natFromInt"><span class="hs-identifier hs-var">natFromInt</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186452"><span class="hs-identifier hs-var">bits</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key -&gt; BitMap
</span><a href="Utils.Containers.Internal.BitUtil.html#shiftRL"><span class="hs-operator hs-var">`shiftRL`</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1073"></span><span>                 </span><span id="local-6989586621679186450"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; BitMap -&gt; BitMap
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">BitMap
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key -&gt; BitMap
</span><a href="Utils.Containers.Internal.BitUtil.html#shiftLL"><span class="hs-operator hs-var">`shiftLL`</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; BitMap -&gt; BitMap
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; BitMap -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1074"></span><span>                           </span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
</span><a href="#local-6989586621679186475"><span class="hs-identifier hs-var">buildTree</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186455"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key -&gt; BitMap
</span><a href="Utils.Containers.Internal.BitUtil.html#shiftRL"><span class="hs-operator hs-var">`shiftRL`</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span>
</span><span id="line-1075"></span><span>                       </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key -&gt; BitMap
</span><a href="Utils.Containers.Internal.BitUtil.html#shiftRL"><span class="hs-operator hs-var">`shiftRL`</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; BitMap -&gt; BitMap
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">BitMap
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key -&gt; BitMap
</span><a href="Utils.Containers.Internal.BitUtil.html#shiftLL"><span class="hs-operator hs-var">`shiftLL`</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; BitMap -&gt; BitMap
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; BitMap -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1076"></span><span>                           </span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
</span><a href="#local-6989586621679186475"><span class="hs-identifier hs-var">buildTree</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186455"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span>
</span><span id="line-1077"></span><span>                       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1078"></span><span>                           </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
</span><a href="#local-6989586621679186475"><span class="hs-identifier hs-var">buildTree</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186455"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Key -&gt; a) -&gt; Key -&gt; BitMap -&gt; Key -&gt; IntMap a
</span><a href="#local-6989586621679186475"><span class="hs-identifier hs-var">buildTree</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a
</span><a href="#local-6989586621679186455"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186454"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BitMap
</span><a href="#local-6989586621679186453"><span class="hs-identifier hs-var">bmask</span></a></span><span> </span><span class="annot"><span class="annottext">BitMap -&gt; Key -&gt; BitMap
</span><a href="Utils.Containers.Internal.BitUtil.html#shiftRL"><span class="hs-operator hs-var">`shiftRL`</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186450"><span class="hs-identifier hs-var">bits2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1079"></span><span>
</span><span id="line-1080"></span><span class="hs-comment">{--------------------------------------------------------------------
  Lists
--------------------------------------------------------------------}</span><span>
</span><span id="line-1083"></span><span class="hs-comment">-- | /O(n*min(n,W))/. Create a map from a list of key\/value pairs.</span><span>
</span><span id="line-1084"></span><span class="hs-comment">--</span><span>
</span><span id="line-1085"></span><span class="hs-comment">-- &gt; fromList [] == empty</span><span>
</span><span id="line-1086"></span><span class="hs-comment">-- &gt; fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (5, &quot;c&quot;)] == fromList [(5,&quot;c&quot;), (3,&quot;b&quot;)]</span><span>
</span><span id="line-1087"></span><span class="hs-comment">-- &gt; fromList [(5,&quot;c&quot;), (3,&quot;b&quot;), (5, &quot;a&quot;)] == fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]</span><span>
</span><span id="line-1088"></span><span>
</span><span id="line-1089"></span><span id="local-6989586621679187052"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromList"><span class="hs-identifier hs-type">fromList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187052"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187052"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1090"></span><span id="fromList"><span class="annot"><span class="annottext">fromList :: forall a. [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromList"><span class="hs-identifier hs-var hs-var">fromList</span></a></span></span><span> </span><span id="local-6989586621679186445"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186445"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1091"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap a -&gt; (Key, a) -&gt; IntMap a)
-&gt; IntMap a -&gt; [(Key, a)] -&gt; IntMap a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; (Key, a) -&gt; IntMap a
forall {a}. IntMap a -&gt; (Key, a) -&gt; IntMap a
</span><a href="#local-6989586621679186444"><span class="hs-identifier hs-var">ins</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186445"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1092"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1093"></span><span>    </span><span id="local-6989586621679186444"><span class="annot"><span class="annottext">ins :: IntMap a -&gt; (Key, a) -&gt; IntMap a
</span><a href="#local-6989586621679186444"><span class="hs-identifier hs-var hs-var">ins</span></a></span></span><span> </span><span id="local-6989586621679186443"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186443"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186442"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186442"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186441"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186441"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186442"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186441"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186443"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1094"></span><span>
</span><span id="line-1095"></span><span class="hs-comment">-- | /O(n*min(n,W))/. Create a map from a list of key\/value pairs with a combining function. See also 'fromAscListWith'.</span><span>
</span><span id="line-1096"></span><span class="hs-comment">--</span><span>
</span><span id="line-1097"></span><span class="hs-comment">-- &gt; fromListWith (++) [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;), (3,&quot;a&quot;), (5,&quot;a&quot;)] == fromList [(3, &quot;ab&quot;), (5, &quot;aba&quot;)]</span><span>
</span><span id="line-1098"></span><span class="hs-comment">-- &gt; fromListWith (++) [] == empty</span><span>
</span><span id="line-1099"></span><span>
</span><span id="line-1100"></span><span id="local-6989586621679187089"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromListWith"><span class="hs-identifier hs-type">fromListWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679187089"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187089"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187089"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187089"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187089"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1101"></span><span id="fromListWith"><span class="annot"><span class="annottext">fromListWith :: forall a. (a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromListWith"><span class="hs-identifier hs-var hs-var">fromListWith</span></a></span></span><span> </span><span id="local-6989586621679186440"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186440"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186439"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186439"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1102"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromListWithKey"><span class="hs-identifier hs-var">fromListWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186438"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186438"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186437"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186437"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186440"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186438"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186437"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186439"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1103"></span><span>
</span><span id="line-1104"></span><span class="hs-comment">-- | /O(n*min(n,W))/. Build a map from a list of key\/value pairs with a combining function. See also fromAscListWithKey'.</span><span>
</span><span id="line-1105"></span><span class="hs-comment">--</span><span>
</span><span id="line-1106"></span><span class="hs-comment">-- &gt; fromListWith (++) [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;), (3,&quot;a&quot;), (5,&quot;a&quot;)] == fromList [(3, &quot;ab&quot;), (5, &quot;aba&quot;)]</span><span>
</span><span id="line-1107"></span><span class="hs-comment">-- &gt; fromListWith (++) [] == empty</span><span>
</span><span id="line-1108"></span><span>
</span><span id="line-1109"></span><span id="local-6989586621679187048"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromListWithKey"><span class="hs-identifier hs-type">fromListWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187048"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187048"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187048"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187048"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187048"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1110"></span><span id="fromListWithKey"><span class="annot"><span class="annottext">fromListWithKey :: forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromListWithKey"><span class="hs-identifier hs-var hs-var">fromListWithKey</span></a></span></span><span> </span><span id="local-6989586621679186435"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186435"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679186434"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186434"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1111"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IntMap a -&gt; (Key, a) -&gt; IntMap a)
-&gt; IntMap a -&gt; [(Key, a)] -&gt; IntMap a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; (Key, a) -&gt; IntMap a
</span><a href="#local-6989586621679186433"><span class="hs-identifier hs-var">ins</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186434"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1112"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1113"></span><span>    </span><span id="local-6989586621679186433"><span class="annot"><span class="annottext">ins :: IntMap a -&gt; (Key, a) -&gt; IntMap a
</span><a href="#local-6989586621679186433"><span class="hs-identifier hs-var hs-var">ins</span></a></span></span><span> </span><span id="local-6989586621679186432"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186432"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679186431"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186431"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186430"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186430"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; Key -&gt; a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var">insertWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186435"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186431"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186430"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186432"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1114"></span><span>
</span><span id="line-1115"></span><span class="hs-comment">-- | /O(n)/. Build a map from a list of key\/value pairs where</span><span>
</span><span id="line-1116"></span><span class="hs-comment">-- the keys are in ascending order.</span><span>
</span><span id="line-1117"></span><span class="hs-comment">--</span><span>
</span><span id="line-1118"></span><span class="hs-comment">-- &gt; fromAscList [(3,&quot;b&quot;), (5,&quot;a&quot;)]          == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-1119"></span><span class="hs-comment">-- &gt; fromAscList [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;b&quot;)]</span><span>
</span><span id="line-1120"></span><span>
</span><span id="line-1121"></span><span id="local-6989586621679186429"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscList"><span class="hs-identifier hs-type">fromAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679186429"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186429"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1122"></span><span id="fromAscList"><span class="annot"><span class="annottext">fromAscList :: forall a. [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromAscList"><span class="hs-identifier hs-var hs-var">fromAscList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
forall a.
Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-identifier hs-var">fromMonoListWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="Data.IntMap.Strict.Internal.html#Nondistinct"><span class="hs-identifier hs-var">Nondistinct</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186426"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186426"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186426"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1123"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscList"><span class="hs-pragma hs-type">fromAscList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1124"></span><span>
</span><span id="line-1125"></span><span class="hs-comment">-- | /O(n)/. Build a map from a list of key\/value pairs where</span><span>
</span><span id="line-1126"></span><span class="hs-comment">-- the keys are in ascending order, with a combining function on equal keys.</span><span>
</span><span id="line-1127"></span><span class="hs-comment">-- /The precondition (input list is ascending) is not checked./</span><span>
</span><span id="line-1128"></span><span class="hs-comment">--</span><span>
</span><span id="line-1129"></span><span class="hs-comment">-- &gt; fromAscListWith (++) [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;ba&quot;)]</span><span>
</span><span id="line-1130"></span><span>
</span><span id="line-1131"></span><span id="local-6989586621679186425"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscListWith"><span class="hs-identifier hs-type">fromAscListWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679186425"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186425"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186425"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679186425"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186425"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1132"></span><span id="fromAscListWith"><span class="annot"><span class="annottext">fromAscListWith :: forall a. (a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromAscListWith"><span class="hs-identifier hs-var hs-var">fromAscListWith</span></a></span></span><span> </span><span id="local-6989586621679186424"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186424"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
forall a.
Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-identifier hs-var">fromMonoListWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="Data.IntMap.Strict.Internal.html#Nondistinct"><span class="hs-identifier hs-var">Nondistinct</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186423"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186423"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679186422"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186422"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679186424"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186423"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186422"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1133"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscListWith"><span class="hs-pragma hs-type">fromAscListWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1134"></span><span>
</span><span id="line-1135"></span><span class="hs-comment">-- | /O(n)/. Build a map from a list of key\/value pairs where</span><span>
</span><span id="line-1136"></span><span class="hs-comment">-- the keys are in ascending order, with a combining function on equal keys.</span><span>
</span><span id="line-1137"></span><span class="hs-comment">-- /The precondition (input list is ascending) is not checked./</span><span>
</span><span id="line-1138"></span><span class="hs-comment">--</span><span>
</span><span id="line-1139"></span><span class="hs-comment">-- &gt; fromAscListWith (++) [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;ba&quot;)]</span><span>
</span><span id="line-1140"></span><span>
</span><span id="line-1141"></span><span id="local-6989586621679186421"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier hs-type">fromAscListWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186421"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186421"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679186421"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679186421"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186421"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1142"></span><span id="fromAscListWithKey"><span class="annot"><span class="annottext">fromAscListWithKey :: forall a. (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier hs-var hs-var">fromAscListWithKey</span></a></span></span><span> </span><span id="local-6989586621679186420"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186420"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
forall a.
Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-identifier hs-var">fromMonoListWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="Data.IntMap.Strict.Internal.html#Nondistinct"><span class="hs-identifier hs-var">Nondistinct</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186420"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-1143"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromAscListWithKey"><span class="hs-pragma hs-type">fromAscListWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1144"></span><span>
</span><span id="line-1145"></span><span class="hs-comment">-- | /O(n)/. Build a map from a list of key\/value pairs where</span><span>
</span><span id="line-1146"></span><span class="hs-comment">-- the keys are in ascending order and all distinct.</span><span>
</span><span id="line-1147"></span><span class="hs-comment">-- /The precondition (input list is strictly ascending) is not checked./</span><span>
</span><span id="line-1148"></span><span class="hs-comment">--</span><span>
</span><span id="line-1149"></span><span class="hs-comment">-- &gt; fromDistinctAscList [(3,&quot;b&quot;), (5,&quot;a&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-1150"></span><span>
</span><span id="line-1151"></span><span id="local-6989586621679186419"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-type">fromDistinctAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679186419"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679186419"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1152"></span><span id="fromDistinctAscList"><span class="annot"><span class="annottext">fromDistinctAscList :: forall a. [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var hs-var">fromDistinctAscList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
forall a.
Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-identifier hs-var">fromMonoListWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="Data.IntMap.Strict.Internal.html#Distinct"><span class="hs-identifier hs-var">Distinct</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Key
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679186417"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186417"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186417"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1153"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromDistinctAscList"><span class="hs-pragma hs-type">fromDistinctAscList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1154"></span><span>
</span><span id="line-1155"></span><span class="hs-comment">-- | /O(n)/. Build a map from a list of key\/value pairs with monotonic keys</span><span>
</span><span id="line-1156"></span><span class="hs-comment">-- and a combining function.</span><span>
</span><span id="line-1157"></span><span class="hs-comment">--</span><span>
</span><span id="line-1158"></span><span class="hs-comment">-- The precise conditions under which this function works are subtle:</span><span>
</span><span id="line-1159"></span><span class="hs-comment">-- For any branch mask, keys with the same prefix w.r.t. the branch</span><span>
</span><span id="line-1160"></span><span class="hs-comment">-- mask must occur consecutively in the list.</span><span>
</span><span id="line-1161"></span><span>
</span><span id="line-1162"></span><span id="local-6989586621679187044"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-identifier hs-type">fromMonoListWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Distinct"><span class="hs-identifier hs-type">Distinct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187044"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187044"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679187044"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187044"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187044"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1163"></span><span id="fromMonoListWithKey"><span class="annot"><span class="annottext">fromMonoListWithKey :: forall a.
Distinct -&gt; (Key -&gt; a -&gt; a -&gt; a) -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-identifier hs-var hs-var">fromMonoListWithKey</span></a></span></span><span> </span><span id="local-6989586621679186416"><span class="annot"><span class="annottext">Distinct
</span><a href="#local-6989586621679186416"><span class="hs-identifier hs-var">distinct</span></a></span></span><span> </span><span id="local-6989586621679186415"><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186415"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186414"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1164"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1165"></span><span>    </span><span id="local-6989586621679186414"><span class="annot"><span class="annottext">go :: [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186414"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="Data.IntMap.Internal.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-1166"></span><span>    </span><span class="annot"><a href="#local-6989586621679186414"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679186413"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186413"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186412"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186412"><span class="hs-identifier hs-var">vx</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679186411"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186411"><span class="hs-identifier hs-var">zs1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186410"><span class="hs-identifier hs-var">addAll'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186413"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186412"><span class="hs-identifier hs-var">vx</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186411"><span class="hs-identifier hs-var">zs1</span></a></span><span>
</span><span id="line-1167"></span><span>
</span><span id="line-1168"></span><span>    </span><span class="hs-comment">-- `addAll'` collects all keys equal to `kx` into a single value,</span><span>
</span><span id="line-1169"></span><span>    </span><span class="hs-comment">-- and then proceeds with `addAll`.</span><span>
</span><span id="line-1170"></span><span>    </span><span id="local-6989586621679186410"><span class="annot"><span class="annottext">addAll' :: Key -&gt; a -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186410"><span class="hs-identifier hs-var hs-var">addAll'</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186408"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186408"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186407"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186407"><span class="hs-identifier hs-var">vx</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1171"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186408"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186407"><span class="hs-identifier hs-var">vx</span></a></span><span>
</span><span id="line-1172"></span><span>    </span><span class="annot"><a href="#local-6989586621679186410"><span class="hs-identifier hs-var">addAll'</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186406"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186406"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186405"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186405"><span class="hs-identifier hs-var">vx</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679186404"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186404"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186403"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186403"><span class="hs-identifier hs-var">vy</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679186402"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186402"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1173"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="Data.IntMap.Strict.Internal.html#Nondistinct"><span class="hs-identifier hs-var">Nondistinct</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="#local-6989586621679186416"><span class="hs-identifier hs-var">distinct</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186406"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186404"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1174"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186401"><span class="annot"><span class="annottext">v :: a
</span><a href="#local-6989586621679186401"><span class="hs-identifier hs-var hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186415"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186406"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186403"><span class="hs-identifier hs-var">vy</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186405"><span class="hs-identifier hs-var">vx</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186410"><span class="hs-identifier hs-var">addAll'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186404"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186401"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186402"><span class="hs-identifier hs-var">zs</span></a></span><span>
</span><span id="line-1175"></span><span>        </span><span class="hs-comment">-- inlined: | otherwise = addAll kx (Tip kx $! vx) (ky : zs)</span><span>
</span><span id="line-1176"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679186400"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186400"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#branchMask"><span class="hs-identifier hs-var">branchMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186406"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186404"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1177"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679186398"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186398"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621679186397"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186397"><span class="hs-identifier hs-var">zs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186396"><span class="hs-identifier hs-var">addMany'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186400"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186404"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186403"><span class="hs-identifier hs-var">vy</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186402"><span class="hs-identifier hs-var">zs</span></a></span><span>
</span><span id="line-1178"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186395"><span class="hs-identifier hs-var">addAll</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186406"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#linkWithMask"><span class="hs-identifier hs-var">linkWithMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186400"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186404"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186398"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-comment">{-kx-}</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186406"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186405"><span class="hs-identifier hs-var">vx</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186397"><span class="hs-identifier hs-var">zs'</span></a></span><span>
</span><span id="line-1179"></span><span>
</span><span id="line-1180"></span><span>    </span><span class="hs-comment">-- for `addAll` and `addMany`, kx is /a/ key inside the tree `tx`</span><span>
</span><span id="line-1181"></span><span>    </span><span class="hs-comment">-- `addAll` consumes the rest of the list, adding to the tree `tx`</span><span>
</span><span id="line-1182"></span><span>    </span><span id="local-6989586621679186395"><span class="annot"><span class="annottext">addAll :: Key -&gt; IntMap a -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186395"><span class="hs-identifier hs-var hs-var">addAll</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186394"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186394"><span class="hs-identifier hs-var">_kx</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186393"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186393"><span class="hs-identifier hs-var">tx</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1183"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186393"><span class="hs-identifier hs-var">tx</span></a></span><span>
</span><span id="line-1184"></span><span>    </span><span class="annot"><a href="#local-6989586621679186395"><span class="hs-identifier hs-var">addAll</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186392"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186392"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186391"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186391"><span class="hs-identifier hs-var">tx</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679186390"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186390"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186389"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186389"><span class="hs-identifier hs-var">vy</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679186388"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186388"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1185"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679186387"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186387"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#branchMask"><span class="hs-identifier hs-var">branchMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186392"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186390"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1186"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679186386"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186386"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621679186385"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186385"><span class="hs-identifier hs-var">zs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186396"><span class="hs-identifier hs-var">addMany'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186387"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186390"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186389"><span class="hs-identifier hs-var">vy</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186388"><span class="hs-identifier hs-var">zs</span></a></span><span>
</span><span id="line-1187"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap a -&gt; [(Key, a)] -&gt; IntMap a
</span><a href="#local-6989586621679186395"><span class="hs-identifier hs-var">addAll</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186392"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#linkWithMask"><span class="hs-identifier hs-var">linkWithMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186387"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186390"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186386"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-comment">{-kx-}</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186391"><span class="hs-identifier hs-var">tx</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186385"><span class="hs-identifier hs-var">zs'</span></a></span><span>
</span><span id="line-1188"></span><span>
</span><span id="line-1189"></span><span>    </span><span class="hs-comment">-- `addMany'` is similar to `addAll'`, but proceeds with `addMany'`.</span><span>
</span><span id="line-1190"></span><span>    </span><span id="local-6989586621679186396"><span class="annot"><span class="annottext">addMany' :: Key -&gt; Key -&gt; a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186396"><span class="hs-identifier hs-var hs-var">addMany'</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186381"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186381"><span class="hs-identifier hs-var">_m</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186380"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186380"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186379"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186379"><span class="hs-identifier hs-var">vx</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1191"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; [(Key, a)] -&gt; Inserted a
forall a. IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186380"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186379"><span class="hs-identifier hs-var">vx</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1192"></span><span>    </span><span class="annot"><a href="#local-6989586621679186396"><span class="hs-identifier hs-var">addMany'</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186378"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186378"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186377"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186376"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186376"><span class="hs-identifier hs-var">vx</span></a></span></span><span> </span><span id="local-6989586621679186375"><span class="annot"><span class="annottext">zs0 :: [(Key, a)]
</span><a href="#local-6989586621679186375"><span class="hs-identifier hs-var">zs0</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679186374"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186373"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186373"><span class="hs-identifier hs-var">vy</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679186372"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186372"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1193"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="Data.IntMap.Strict.Internal.html#Nondistinct"><span class="hs-identifier hs-var">Nondistinct</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Distinct
</span><a href="#local-6989586621679186416"><span class="hs-identifier hs-var">distinct</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1194"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186371"><span class="annot"><span class="annottext">v :: a
</span><a href="#local-6989586621679186371"><span class="hs-identifier hs-var hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679186415"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186373"><span class="hs-identifier hs-var">vy</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186376"><span class="hs-identifier hs-var">vx</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186396"><span class="hs-identifier hs-var">addMany'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186378"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186371"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186372"><span class="hs-identifier hs-var">zs</span></a></span><span>
</span><span id="line-1195"></span><span>        </span><span class="hs-comment">-- inlined: | otherwise = addMany m kx (Tip kx $! vx) (ky : zs)</span><span>
</span><span id="line-1196"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#mask"><span class="hs-identifier hs-var">mask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186378"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#mask"><span class="hs-identifier hs-var">mask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186378"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1197"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; [(Key, a)] -&gt; Inserted a
forall a. IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186376"><span class="hs-identifier hs-var">vx</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186375"><span class="hs-identifier hs-var">zs0</span></a></span><span>
</span><span id="line-1198"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679186369"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186369"><span class="hs-identifier hs-var">mxy</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#branchMask"><span class="hs-identifier hs-var">branchMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1199"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679186368"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186368"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621679186367"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186367"><span class="hs-identifier hs-var">zs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186396"><span class="hs-identifier hs-var">addMany'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186369"><span class="hs-identifier hs-var">mxy</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186373"><span class="hs-identifier hs-var">vy</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186372"><span class="hs-identifier hs-var">zs</span></a></span><span>
</span><span id="line-1200"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186366"><span class="hs-identifier hs-var">addMany</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186378"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#linkWithMask"><span class="hs-identifier hs-var">linkWithMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186369"><span class="hs-identifier hs-var">mxy</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186374"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186368"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-comment">{-kx-}</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; a -&gt; IntMap a
forall a. Key -&gt; a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186377"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IntMap a) -&gt; a -&gt; IntMap a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186376"><span class="hs-identifier hs-var">vx</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186367"><span class="hs-identifier hs-var">zs'</span></a></span><span>
</span><span id="line-1201"></span><span>
</span><span id="line-1202"></span><span>    </span><span class="hs-comment">-- `addAll` adds to `tx` all keys whose prefix w.r.t. `m` agrees with `kx`.</span><span>
</span><span id="line-1203"></span><span>    </span><span id="local-6989586621679186366"><span class="annot"><span class="annottext">addMany :: Key -&gt; Key -&gt; IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186366"><span class="hs-identifier hs-var hs-var">addMany</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186365"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186365"><span class="hs-identifier hs-var">_m</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186364"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186364"><span class="hs-identifier hs-var">_kx</span></a></span></span><span> </span><span id="local-6989586621679186363"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186363"><span class="hs-identifier hs-var">tx</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1204"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; [(Key, a)] -&gt; Inserted a
forall a. IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186363"><span class="hs-identifier hs-var">tx</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1205"></span><span>    </span><span class="annot"><a href="#local-6989586621679186366"><span class="hs-identifier hs-var">addMany</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186362"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186362"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679186361"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186361"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679186360"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186360"><span class="hs-identifier hs-var">tx</span></a></span></span><span> </span><span id="local-6989586621679186359"><span class="annot"><span class="annottext">zs0 :: [(Key, a)]
</span><a href="#local-6989586621679186359"><span class="hs-identifier hs-var">zs0</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679186358"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186358"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679186357"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186357"><span class="hs-identifier hs-var">vy</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679186356"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186356"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1206"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#mask"><span class="hs-identifier hs-var">mask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186361"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186362"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#mask"><span class="hs-identifier hs-var">mask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186358"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186362"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1207"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a -&gt; [(Key, a)] -&gt; Inserted a
forall a. IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186360"><span class="hs-identifier hs-var">tx</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186359"><span class="hs-identifier hs-var">zs0</span></a></span><span>
</span><span id="line-1208"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679186355"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186355"><span class="hs-identifier hs-var">mxy</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; Key
</span><a href="Data.IntMap.Internal.html#branchMask"><span class="hs-identifier hs-var">branchMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186361"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186358"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1209"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-type">Inserted</span></a></span><span> </span><span id="local-6989586621679186354"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186354"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621679186353"><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186353"><span class="hs-identifier hs-var">zs'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186396"><span class="hs-identifier hs-var">addMany'</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186355"><span class="hs-identifier hs-var">mxy</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186358"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679186357"><span class="hs-identifier hs-var">vy</span></a></span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186356"><span class="hs-identifier hs-var">zs</span></a></span><span>
</span><span id="line-1210"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; [(Key, a)] -&gt; Inserted a
</span><a href="#local-6989586621679186366"><span class="hs-identifier hs-var">addMany</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186362"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186361"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
forall a. Key -&gt; Key -&gt; IntMap a -&gt; IntMap a -&gt; IntMap a
</span><a href="Data.IntMap.Internal.html#linkWithMask"><span class="hs-identifier hs-var">linkWithMask</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186355"><span class="hs-identifier hs-var">mxy</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621679186358"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186354"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-comment">{-kx-}</span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621679186360"><span class="hs-identifier hs-var">tx</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Key, a)]
</span><a href="#local-6989586621679186353"><span class="hs-identifier hs-var">zs'</span></a></span><span>
</span><span id="line-1211"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.IntMap.Strict.Internal.html#fromMonoListWithKey"><span class="hs-pragma hs-type">fromMonoListWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1212"></span><span>
</span><span id="line-1213"></span><span class="hs-keyword">data</span><span> </span><span id="Inserted"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span></span><span> </span><span id="local-6989586621679187038"><span class="annot"><a href="#local-6989586621679187038"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Inserted"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Inserted"><span class="hs-identifier hs-var">Inserted</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679187038"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.IntSet.Internal.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679187038"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1214"></span><span>
</span><span id="line-1215"></span><span class="hs-keyword">data</span><span> </span><span id="Distinct"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Distinct"><span class="hs-identifier hs-var">Distinct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Distinct"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Distinct"><span class="hs-identifier hs-var">Distinct</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Nondistinct"><span class="annot"><a href="Data.IntMap.Strict.Internal.html#Nondistinct"><span class="hs-identifier hs-var">Nondistinct</span></a></span></span><span>
</span><span id="line-1216"></span></pre></body></html>